Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align error messages #308

Closed
navidshaikh opened this issue Sep 12, 2019 · 3 comments · Fixed by #309
Closed

Align error messages #308

navidshaikh opened this issue Sep 12, 2019 · 3 comments · Fixed by #309
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@navidshaikh
Copy link
Contributor

navidshaikh commented Sep 12, 2019

There are different text / format of error printed if tkn couldn't reach the cluster, in this case I am using OCP and I need to re-login to cluster to access the cluster. Listing below error messages I received listing different resources.

16:53 ➜  catalog git:(master) ✗  tkn task list
No tasks found
Error: Unauthorized
Usage:
tkn task list [flags]

Aliases:
  list, ls

Flags:
      --allow-missing-template-keys   If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true)
  -h, --help                          help for list
  -o, --output string                 Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.
      --template string               Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].

Global Flags:
  -k, --kubeconfig string   kubectl config file (default: $HOME/.kube/config)
  -n, --namespace string    namespace to use (default: from $KUBECONFIG)

16:53 ➜  catalog git:(master) ✗  tkn taskrun list
Failed to list taskruns from default namespace 
Error: Unauthorized
Usage:
tkn taskrun list [flags]

Aliases:
  list, ls

Examples:
  
# List all TaskRuns of Task name 'foo'
tkn taskrun list  foo -n bar

# List all taskruns in a namespaces 'foo'
tkn tr list -n foo \n",


Flags:
      --allow-missing-template-keys   If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true)
  -h, --help                          help for list
  -l, --limit int                     limit taskruns listed (default: return all taskruns)
  -o, --output string                 Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.
      --template string               Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].

Global Flags:
  -k, --kubeconfig string   kubectl config file (default: $HOME/.kube/config)
  -n, --namespace string    namespace to use (default: from $KUBECONFIG)

16:53 ➜  catalog git:(master) ✗  tkn resource list
Failed to list pipelineresources from default namespace 
Error: Unauthorized
16:53 ➜  catalog git:(master) ✗  tkn pipelinerun list
Failed to list pipelineruns from default namespace 
Error: Unauthorized
Usage:
tkn pipelinerun list [flags]

Aliases:
  list, ls

Examples:
  
# List all PipelineRuns of Pipeline name 'foo'
tkn pipelinerun list foo -n bar

# List all pipelineruns in a namespaces 'foo'
tkn pr list -n foo",


Flags:
      --allow-missing-template-keys   If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true)
  -h, --help                          help for list
  -l, --limit int                     limit pipelineruns listed (default: return all pipelineruns)
  -o, --output string                 Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.
      --template string               Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].

Global Flags:
  -k, --kubeconfig string   kubectl config file (default: $HOME/.kube/config)
  -n, --namespace string    namespace to use (default: from $KUBECONFIG)

16:53 ➜  catalog git:(master) ✗  tkn pipeline list   
Failed to list pipelines from default namespace
Error: Unauthorized
16:54 ➜  catalog git:(master) ✗  tkn clustertask list
No clustertasks found
Error: Unauthorized
Usage:
tkn clustertask list [flags]

Aliases:
  list, ls

Flags:
      --allow-missing-template-keys   If true, ignore any errors in templates when a field or map key is missing in the template. Only applies to golang and jsonpath output formats. (default true)
  -h, --help                          help for list
  -o, --output string                 Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-file.
      --template string               Template string or path to template file to use when -o=go-template, -o=go-template-file. The template format is golang templates [http://golang.org/pkg/text/template/#pkg-overview].

Global Flags:
  -k, --kubeconfig string   kubectl config file (default: $HOME/.kube/config)
  -n, --namespace string    namespace to use (default: from $KUBECONFIG)

  1. Notice the different error messages printed
  2. Printing help text immediately after the error makes it difficult to locate the actual error, should printing help text be disabled if error occurs ?
✗  tkn version
Client version: 0.3.1
@danielhelfand
Copy link
Member

Thanks for finding this and reporting it. Of note here, the help message (i.e. list of all the options for a command) will go away from error messages with #292.

So this issue comes down to changing the text for error messages returned.

@danielhelfand
Copy link
Member

danielhelfand commented Sep 12, 2019

/assign

@chmouel
Copy link
Member

chmouel commented Sep 12, 2019

/kind bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants