BBVA / qed

The scalable, auditable and high-performance tamper-evident log project
https://qed.readthedocs.io/
Apache License 2.0
95 stars 19 forks source link

Improve cli error handling #51

Closed suizman closed 5 years ago

suizman commented 5 years ago

I've detected whenever we use the cli and it returns an error, Cobra always returns the usage message. Even when we pass the right parameters.

How to reproduce:

$ go run ../main.go -k pepe client membership --key 0 --version 1 -l info     

QedClient: 2018/10/11 11:00:05.575712 /home/spark/go/src/github.com/bbva/qed/cmd/client_membership.go:53: Querying key [ 0 ] with version [ 1 ]
Error: Unexpected server error
Usage:
  qed client membership [flags]

Flags:
  -h, --help                   help for membership
      --historyDigest string   Digest of the history tree
      --hyperDigest string     Digest of the hyper tree
      --key string             Key to query
      --verify                 Do verify received proof
      --version uint           Version to query

Global Flags:
  -k, --apikey string     Server api key
  -e, --endpoint string   Endpoint for REST requests on (host:port) (default "http://localhost:8080")
  -l, --log string        Choose between log levels: silent, error, info and debug (default "error")

exit status 255

We've seen an possible solution in this Cobra issue

suizman commented 5 years ago

Oh, we've fixed this one a month ago 2618bf496b0d848517bc65f5ff7ac158b71f189d -> https://github.com/spf13/cobra/issues/340