module ¶
Classes:
-
CustomImportError–Raised when there's a general import error.
-
DependencyNotFoundError–Raised when there's a missing optional dependency.
CustomImportError ¶
CustomImportError(
func: FuncExcept,
package: str | ImportError,
message: SupportsString = "Import failed for package '{package}'!",
**kwargs: Any
)
Bases: CustomError, ImportError
Raised when there's a general import error.
Parameters:
-
(func¶FuncExcept) –Function this error was raised from.
-
(package¶str | ImportError) –Either the raised error or the name of the missing package.
-
(message¶SupportsString, default:"Import failed for package '{package}'!") –Custom error message.
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.
Attributes:
Source code in jetpytools/exceptions/module.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | |
__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 | |
DependencyNotFoundError ¶
DependencyNotFoundError(
func: FuncExcept,
package: str | ImportError,
message: SupportsString = "Missing dependency '{package}'!",
**kwargs: Any
)
Bases: CustomImportError
Raised when there's a missing optional dependency.
Parameters:
-
(func¶FuncExcept) –Function this error was raised from.
-
(package¶str | ImportError) –Either the raised error or the name of the missing package.
-
(message¶SupportsString, default:"Import failed for package '{package}'!") –Custom error message.
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.
Attributes:
Source code in jetpytools/exceptions/module.py
34 35 36 37 38 39 40 41 | |
__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 | |