search for: 7c2fb59

Displaying 4 results from an estimated 4 matches for "7c2fb59".

2019 Jun 28
1
Re: [PATCH libnbd v3] python: Raise a custom exception containing error string and errno.
...or None if Python errno.errorcode couldn't map it to a name), and .errnum (raw numeric value, accessible no matter what). Maybe as simple as this (or with one further tweak to __str__ to at least output .errnum when .errno is None): diff --git i/generator/generator w/generator/generator index 7c2fb59..9192988 100755 --- i/generator/generator +++ w/generator/generator @@ -3944,11 +3944,14 @@ from libnbdmod import Error Error.__doc__ = ''' Exception thrown when the underlying libnbd call fails. -This exception has two properties to query the error. Use +This exception has three pr...
2019 Jun 28
0
[PATCH libnbd v3] python: Raise a custom exception containing error string and errno.
...Transport endpoint is not connected (ENOTCONN) --- generator/generator | 53 ++++++++++++++++++++++++++++++++++++++- python/t/610-exception.py | 32 +++++++++++++++++++++++ 2 files changed, 84 insertions(+), 1 deletion(-) diff --git a/generator/generator b/generator/generator index 157a9cb..7c2fb59 100755 --- a/generator/generator +++ b/generator/generator @@ -3337,6 +3337,19 @@ get_handle (PyObject *obj) return (struct nbd_handle *) PyCapsule_GetPointer(obj, \"nbd_handle\"); } +/* nbd.Error exception. */ +extern PyObject *nbd_internal_py_Error; + +static inline void +raise_ex...
2019 Jun 28
3
[PATCH libnbd v3] python: Raise a custom exception containing error string and errno.
Following Eric's suggestions from v2, this adds .string, .errno and .__str__ properties. The .string property returns the error string. The .errno property returns the errno (from the errno module), or None. The __str__ property makes the exception nicely printable. Rich.
2019 Jun 28
2
Re: [PATCH libnbd v3] python: Raise a custom exception containing error string and errno.
On 6/28/19 1:27 PM, Richard W.M. Jones wrote: > Previously errors caused a RuntimeException to be raised. This commit > defines a custom exception (nbd.Error) which has two parameters, the > required error string, and the optional errno (which may be 0 if > unavailable). > > For example: > > $ ./run nbdsh -c 'h.pread(0, 0)' > Traceback (most recent call last):