module documentation
Exception definitions and pretty-printing.
| Exception | |
An error class we can control and pretty-print. |
| Function | docstring_for_ |
Add a docstring to an NT2Error_from function. |
| Function | friendly |
Catch and pretty-print any exceptions when calling. |
| Function | inspect |
Pretty-print an exception to stderr for the user to see. |
| Function | mk |
Return a decorator that raises an exception if format_name support is not installed. |
| Function | |
Return an NTTError based on the exception if possible. |
| Function | |
Return exc, as-is. |
Add a docstring to an NT2Error_from function.
| Parameters | |
func:Callable | An NT2Error_from function. |
| Returns | |
Callable | The same function, with a new docstring. |
Catch and pretty-print any exceptions when calling.
# noqa: DAR101 wrapped args instance kwargs # noqa: DAR201
Pretty-print an exception to stderr for the user to see.
| Parameters | |
exc:Exception | Any Exception. After printing, it is swallowed, not raised. |
def mk_require_support(*, format_name:
str, supported: bool, extras_name: str) -> Callable:
(source)
¶
Return a decorator that raises an exception if format_name support is not installed.
| Parameters | |
formatstr | The name of the format. |
supported:bool | Whether the format is supported. |
extrasstr | The name of the corresponding extras in the Python package. |
| Returns | |
Callable | A decorator that raises an exception if format_name support is not installed. |
Return an NTTError based on the exception if possible.
Otherwise, raise the original exception.
| Parameters | |
exc:Exception | Any exception. |
| Returns | |
NTTError | Undocumented |
| Raises | |
exc | If exc can't be converted to an NTTError. |