exceptions

Custom exception classes.

These vary in use case from “we needed a specific data structure layout in exceptions used for message-passing” to simply “we needed to express an error condition in a way easily told apart from other, truly unexpected errors”.

exception invoke.exceptions.AmbiguousEnvVar

Raised when loading env var config keys has an ambiguous target.

__weakref__

list of weak references to the object (if defined)

exception invoke.exceptions.Exit(code=0)

Simple stand-in for SystemExit that lets us gracefully exit.

Removes lots of scattered sys.exit calls, improves testability.

__weakref__

list of weak references to the object (if defined)

exception invoke.exceptions.Failure(result)

Exception subclass representing failure of a command execution.

It exhibits a result attribute containing the related Result object, whose attributes may be inspected to determine why the command failed.

__weakref__

list of weak references to the object (if defined)

exception invoke.exceptions.PlatformError

Raised when an illegal operation occurs for the current platform.

E.g. Windows users trying to use functionality requiring the pty module.

Typically used to present a clearer error message to the user.

__weakref__

list of weak references to the object (if defined)

exception invoke.exceptions.ThreadException(exceptions)

One or more exceptions were raised within background (usually I/O) threads.

The real underlying exceptions are stored in the exceptions attribute; see its documentation for data structure details.

Note

Threads which did not encounter an exception, do not contribute to this exception object and thus are not present inside exceptions.

__weakref__

list of weak references to the object (if defined)

exceptions = ()

A tuple of ExceptionWrappers containing the initial thread constructor kwargs (because threading.Thread subclasses should always be called with kwargs) and the caught exception for that thread as seen by sys.exc_info (so: type, value, traceback).

Note

The ordering of this attribute is not well-defined.

Note

Thread kwargs which appear to be very long (e.g. IO buffers) will be truncated when printed, to avoid huge unreadable error display.

exception invoke.exceptions.UncastableEnvVar

Raised on attempted env var loads whose default values are too rich.

E.g. trying to stuff MY_VAR="foo" into {'my_var': ['uh', 'oh']} doesn’t make any sense until/if we implement some sort of transform option.

__weakref__

list of weak references to the object (if defined)

exception invoke.exceptions.UnknownFileType

A config file of an unknown type was specified and cannot be loaded.

__weakref__

list of weak references to the object (if defined)

class invoke.exceptions.ExceptionWrapper(kwargs, type, value, traceback)

A namedtuple wrapping a thread-borne exception & that thread’s arguments.