class Failure(Exception): (source)
Known subclasses: invoke.exceptions.AuthFailure
, invoke.exceptions.CommandTimedOut
, invoke.exceptions.UnexpectedExit
Exception subclass representing failure of a command execution. "Failure" may mean the command executed and the shell indicated an unusual result (usually, a non-zero exit code), or it may mean something else, like a ``sudo`` command which was aborted when the supplied password failed authentication. Two attributes allow introspection to determine the nature of the problem: * ``result``: a `.Result` instance with info about the command being executed and, if it ran to completion, how it exited. * ``reason``: a wrapped exception instance if applicable (e.g. a `.StreamWatcher` raised `WatcherError`) or ``None`` otherwise, in which case, it's probably a `Failure` subclass indicating its own specific nature, such as `UnexpectedExit` or `CommandTimedOut`. This class is only rarely raised by itself; most of the time `.Runner.run` (or a wrapper of same, such as `.Context.sudo`) will raise a specific subclass like `UnexpectedExit` or `AuthFailure`. .. versionadded:: 1.0
Method | __init__ |
Undocumented |
Method | __repr__ |
Undocumented |
Method | streams |
Return stdout/err streams as necessary for error display. |
Instance Variable | reason |
Undocumented |
Instance Variable | result |
Undocumented |
Method | _repr |
Return ``__repr__``-like value from inner result + any kwargs. |
Return stdout/err streams as necessary for error display. Subject to the following rules: - If a given stream was *not* hidden during execution, a placeholder is used instead, to avoid printing it twice. - Only the last 10 lines of stream text is included. - PTY-driven execution will lack stderr, and a specific message to this effect is returned instead of a stderr dump. :returns: Two-tuple of stdout, stderr strings. .. versionadded:: 1.3
invoke.exceptions.UnexpectedExit
Return ``__repr__``-like value from inner result + any kwargs.