generic ¶
Classes:
-
MismatchError–Raised when there's a mismatch between two or more values.
-
MismatchRefError–
MismatchError ¶
MismatchError(
func: FuncExcept,
items: Iterable[Any],
message: SupportsString = "All items must be equal!",
reason: Any = "{reduced_items}",
**kwargs: Any
)
Bases: CustomValueError
Raised when there's a mismatch between two or more values.
Instantiate a new exception with pretty printing and more.
Parameters:
-
(message¶SupportsString | None, default:None) –Message of the error.
-
(func¶FuncExcept | None, default:None) –Function this exception was raised from.
-
(reason¶Any, default:None) –Reason of the exception. For example, an optional parameter.
Methods:
-
__call__–Copy an existing exception with defaults and instantiate a new one.
-
catch–Create a context manager that catches exceptions of this class type.
-
check–
Attributes:
Source code in jetpytools/exceptions/generic.py
22 23 24 25 26 27 28 29 30 | |
__call__ ¶
__call__(
message: SupportsString | None | MissingT = MISSING,
func: FuncExcept | None | MissingT = MISSING,
reason: SupportsString | FuncExcept | None | MissingT = MISSING,
**kwargs: Any
) -> Self
Copy an existing exception with defaults and instantiate a new one.
Parameters:
-
(message¶SupportsString | None | MissingT, default:MISSING) –Message of the error.
-
(func¶FuncExcept | None | MissingT, default:MISSING) –Function this exception was raised from.
-
(reason¶SupportsString | FuncExcept | None | MissingT, default:MISSING) –Reason of the exception. For example, an optional parameter.
Source code in jetpytools/exceptions/base.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
catch classmethod ¶
catch() -> CatchError[Self]
Create a context manager that catches exceptions of this class type.
Returns:
-
CatchError[Self]–CatchError[Self]: A context manager that will catch and store exceptions of type
clswhen used in awithblock.
Source code in jetpytools/exceptions/base.py
134 135 136 137 138 139 140 141 142 143 | |
check classmethod ¶
check(func: FuncExcept, /, *items: Any, **kwargs: Any) -> None
Source code in jetpytools/exceptions/generic.py
32 33 34 35 | |
MismatchRefError ¶
MismatchRefError(
func: FuncExcept,
base: T,
ref: T,
message: SupportsString = "All items must be equal!",
**kwargs: Any
)
Bases: MismatchError
Instantiate a new exception with pretty printing and more.
Parameters:
-
(message¶SupportsString | None, default:None) –Message of the error.
-
(func¶FuncExcept | None, default:None) –Function this exception was raised from.
-
(reason¶Any, default:None) –Reason of the exception. For example, an optional parameter.
Methods:
-
__call__–Copy an existing exception with defaults and instantiate a new one.
-
catch–Create a context manager that catches exceptions of this class type.
-
check–
Attributes:
Source code in jetpytools/exceptions/generic.py
39 40 41 42 | |
__call__ ¶
__call__(
message: SupportsString | None | MissingT = MISSING,
func: FuncExcept | None | MissingT = MISSING,
reason: SupportsString | FuncExcept | None | MissingT = MISSING,
**kwargs: Any
) -> Self
Copy an existing exception with defaults and instantiate a new one.
Parameters:
-
(message¶SupportsString | None | MissingT, default:MISSING) –Message of the error.
-
(func¶FuncExcept | None | MissingT, default:MISSING) –Function this exception was raised from.
-
(reason¶SupportsString | FuncExcept | None | MissingT, default:MISSING) –Reason of the exception. For example, an optional parameter.
Source code in jetpytools/exceptions/base.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | |
catch classmethod ¶
catch() -> CatchError[Self]
Create a context manager that catches exceptions of this class type.
Returns:
-
CatchError[Self]–CatchError[Self]: A context manager that will catch and store exceptions of type
clswhen used in awithblock.
Source code in jetpytools/exceptions/base.py
134 135 136 137 138 139 140 141 142 143 | |
check classmethod ¶
check(func: FuncExcept, /, *items: Any, **kwargs: Any) -> None
Source code in jetpytools/exceptions/generic.py
44 45 46 47 | |