wend.errors¶
Exception hierarchy.
Every error raised deliberately by wend derives from WendError. Errors that
signal an unacceptable value also derive from ValueError, so callers that
already handle pathlib's ValueError keep working. Misused arguments raise
TypeError or ValueError, as Python's own functions do; the private helpers
at the end hold the argument rules that several entry points share.
MissingBindingError
¶
Bases: WendError, ValueError
Resolution was attempted without values for some parameters.
InvalidBindingError
¶
Bases: WendError, ValueError
A bound value is not acceptable at the position where it is used.
Raised when a value would silently change the segment structure of the
expression (a separator inside a segment, an empty segment, .), escape
upwards (..), or violate a declared type, kind or set of choices.
PathOperationError
¶
Bases: WendError, ValueError
A path operation is invalid for this expression (mirrors pathlib's ValueError).
NotStaticError
¶
Bases: WendError
The requested information depends on parameter values that are not bound.
AmbiguousMatchError
¶
Bases: WendError, ValueError
A concrete path matches the expression with more than one set of bindings.
ParamConflictError
¶
Bases: WendError, ValueError
Two different parameter declarations share a name within one expression.
ConditionError
¶
Bases: WendError
A declared condition does not hold for a rendered path (§10).
path is the rendered path and condition the condition that failed.
Subclasses also derive from the builtin exception that describes the same
failure, so except FileNotFoundError keeps working.
IndeterminateError
¶
Bases: ConditionError
Whether a condition holds could not be determined (§10).
The filesystem could not say: the path could not be examined (no
permission to look, a symlink loop, a failed request), or the backend
cannot report the capability without exercising it (whether an object
store would accept a write). It is not a known failure, which is a
CapabilityError, MissingPathError, PathExistsError or
WrongKindError.
MissingPathError
¶
PathExistsError
¶
Bases: ConditionError, FileExistsError
A path required to be absent exists (possibly as a broken symlink).
WrongKindError
¶
CapabilityError
¶
Bases: ConditionError, PermissionError
A path cannot be used as declared: read, written, created or listed.
ContainmentError
¶
Bases: ConditionError, InvalidBindingError
A path is not under the base it was declared to be under.
Raised by render when the bindings take the path lexically outside the
base, and by check when it resolves outside it through symlinks.
NoAlternativeError
¶
NoAlternativeError(tried: list[tuple[str, ConditionError]])
Bases: ConditionError, FileNotFoundError
No alternative of a union exists (or meets its preconditions).
tried lists each rendered alternative with the condition error that
ruled it out, in order.