Commit 74d5818d authored by Richard W.M. Jones's avatar Richard W.M. Jones
Browse files

info: Improve error message when the export may be unknown to the server

For example:

  $ nbdkit -r file dir=/var/tmp/disks --run 'nbdinfo $uri'
  nbdkit: file[1]: error: open: : No such file or directory
  nbdkit: file[1]: error: open: : No such file or directory
  nbdinfo: nbd_opt_go: server replied with error to opt_go request: No such file or directory for export:

What happened here is we requested the default export (because the
nbdkit-provided $uri points to that).  nbdkit-file-plugin doesn't
provide a default export so that's an error.

However the error message is weird and unactionable.  We print the
default export name, but as that is an empty string we end up printing
"for export: ".  And we don't tell the user what they can do to
recover from this.

After this commit the message has been improved:

  $ nbdkit -r file dir=/var/tmp/disks --run 'nbdinfo $uri '
  nbdkit: file[1]: error: open: : No such file or directory
  nbdkit: file[1]: error: open: : No such file or directory
  nbdinfo: nbd_opt_go: server replied with error to opt_go request: No such file or directory for the default export
  nbdinfo: suggestion: to list all exports on the server, use --list

We now print "default export" if we spot that the default export was
requested, and we print an actionable suggestion.
parent bf4a8911
Pipeline #602734531 failed with stage
in 9 minutes and 39 seconds
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment