Skip to content

Commit

Permalink
adding --verbose parameter for detailed error
Browse files Browse the repository at this point in the history
  • Loading branch information
saaadAF committed Oct 31, 2024
1 parent a162c14 commit f5da871
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type flags struct {
APICluster string `help:"Context name of the API cluster." default:"${api_cluster}" env:"NCTL_API_CLUSTER"`
LogAPIAddress string `help:"Address of the deplo.io logging API server." default:"https://logs.deplo.io" env:"NCTL_LOG_ADDR"`
LogAPIInsecure bool `help:"Don't verify TLS connection to the logging API server." hidden:"" default:"false" env:"NCTL_LOG_INSECURE"`
Verbose bool `help:"Show detailed error message."`
Version kong.VersionFlag `name:"version" help:"Print version information and quit."`
}

Expand Down Expand Up @@ -158,9 +159,8 @@ func main() {

err = kongCtx.Run(ctx, client)
if err != nil {
if k8serrors.IsForbidden(err) {
kongCtx.Fatalf("Permission denied: are you part of the org?")

if k8serrors.IsForbidden(err) && !nctl.Verbose {
kongCtx.Fatalf("Permission denied: are you part of the organization?\nuse --verbose to see detailed error")
}else{
kongCtx.FatalIfErrorf(err)
}
Expand Down

0 comments on commit f5da871

Please sign in to comment.