[Libguestfs] [PATCH libnbd v2] python: Raise a custom exception containing error string and errno.

Richard W.M. Jones rjones at redhat.com
Fri Jun 28 12:31:28 UTC 2019


This kind of fixes the problems in v1.  The exception still primarily
lives in the libnbdmod and you could still refer to it using
libnbdmod.Error (but don't do that).  However when the exception is
printed it now appears as nbd.Error, and you can catch it also using
the same name.

Other problems:

 - There is no "nice" interface to accessing the exception fields.
   You have to use ex.args[0] and ex.args[1].

 - The errno is represented as a number, which means it will be hard
   to write portable Python code depending on the errno.

Rich.





More information about the Libguestfs mailing list