You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When we face an error, cobra prints the whole command usage, and also the error again, which is noisy.
Example
→ bacalhau job describe j033
11:58:29.663 | INF ProtocolLabs/workspace/bacalhau/pkg/repo/fs.go:92 > Initializing repo at '/var/folders/vz/pk7pk9qx1c5gbktg8nhyl88h0000gn/T/tmp.t9RCAPgQtw' for environment 'production'
Error: could not get job j033: Unexpected response code: 500 ({
"error": "Job not found. ID: j033",
"message": "Internal Server Error"
})
Usage:
bacalhau job describe [id] [flags]
Examples:
# Describe a job with the full ID
bacalhau job describe j-e3f8c209-d683-4a41-b840-f09b88d087b9
# Describe a job with the a shortened ID
bacalhau job describe j-47805f5c
# Describe a job with json output
bacalhau job describe --output json --pretty j-b6ad164a
Flags:
-h, --help help for describe
--output format The output format for the command (one of ["json" "yaml"])
--pretty Pretty print the output. Only applies to json and yaml output formats.
Global Flags:
--api-host string The host for the client and server to communicate on (via REST).
Ignored if BACALHAU_API_HOST environment variable is set. (default "bootstrap.production.bacalhau.org")
--api-port int The port for the client and server to communicate on (via REST).
Ignored if BACALHAU_API_PORT environment variable is set. (default 1234)
--cacert string The location of a CA certificate file when self-signed certificates
are used by the server
-c, --config string config file(s) or dot separated path(s) to config values
--insecure Enables TLS but does not verify certificates
--log-mode logging-mode Log format: 'default','station','json','combined','event' (default default)
-r, --repo string filesystem path to bacalhau repo (default "/var/folders/vz/pk7pk9qx1c5gbktg8nhyl88h0000gn/T/tmp.t9RCAPgQtw")
--tls Instructs the client to use TLS
could not get job j033: Unexpected response code: 500 ({
"error": "Job not found. ID: j033",
"message": "Internal Server Error"
})
Desired Behaviour
Just print the error, and make it clear that this is an error, by either prefixing with Error: or in a different color like we do when we print errors in job history events
// SilenceErrors is an option to quiet errors down stream.
SilenceErrors bool
// SilenceUsage is an option to silence usage when an error occurs.
SilenceUsage bool
When we face an error, cobra prints the whole command usage, and also the error again, which is noisy.
Example
Desired Behaviour
Just print the error, and make it clear that this is an error, by either prefixing with
Error:
or in a different color like we do when we print errors in job history eventsbacalhau/cmd/util/printer/job_progress_printer.go
Lines 70 to 72 in e7c052c
The text was updated successfully, but these errors were encountered: