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.
Please register or sign in to comment