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

Report CLI configurations errors to RunE #351

Merged
merged 4 commits into from Dec 24, 2021
Merged

Report CLI configurations errors to RunE #351

merged 4 commits into from Dec 24, 2021

Conversation

bryanhuhta
Copy link
Contributor

closes #265

This change updates CLI commands to use RunE in place of Run so user configuration errors can be reported and distinguished from actual system failures. Not all commands had obvious possible user configuration errors, but I migrated all commands to use RunE in the event that in the future the command may have possible user configuration errors.

Old:

$ spicedb migrate 1 --datastore-engine
9:08PM INF set log level new level=info
9:08PM INF set tracing provider new provider=none
9:08PM FTL cannot migrate datastore engine type datastore-engine=bad
exit status 1

New:

$ spicedb migrate 1 --datastore-engine bad 
9:10PM INF set log level new level=info
9:10PM INF set tracing provider new provider=none
Error: cannot migrate datastore engine type: bad
Usage:
  spicedb migrate [revision] [flags]

Flags:
      --datastore-conn-uri string   connection string used by remote datastores (e.g. "postgres://postgres:password@localhost:5432/spicedb")
      --datastore-engine string     type of datastore to initialize ("memory", "postgres", "cockroachdb") (default "memory")
  -h, --help                        help for migrate

Global Flags:
      --log-format string                 format of logs ("auto", "human", "json") (default "auto")
      --log-level string                  verbosity of logging ("trace", "debug", "info", "warn", "error") (default "info")
      --otel-jaeger-endpoint string       jaeger collector endpoint (default "http://jaeger:14268/api/traces")
      --otel-jaeger-service-name string   jaeger service name for trace data (default "spicedb")
      --otel-provider string              opentelemetry provider for tracing ("none", "jaeger") (default "none")

Bryan Huhta added 4 commits December 23, 2021 17:57
Signed-off-by: Bryan Huhta <bryanhuhta@github.com>
Signed-off-by: Bryan Huhta <bryanhuhta@github.com>
Signed-off-by: Bryan Huhta <bryanhuhta@github.com>
Signed-off-by: Bryan Huhta <bryanhuhta@github.com>
@github-actions github-actions bot added the area/CLI Affects the command line label Dec 24, 2021
@jzelinskie jzelinskie merged commit 1697fb6 into authzed:main Dec 24, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Dec 24, 2021
@bryanhuhta bryanhuhta deleted the bryanhuhta/cli-errors branch December 24, 2021 17:08
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/CLI Affects the command line
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CLI configuration errors should return instead of fatal logging
2 participants