viat.exceptions
¶
Exceptions (errors and warnings) common to all modules.
ValidationExceptionMixin
¶
Bases: Exception
Mixin for exceptions related to validation.
Source code in src/viat/exceptions.py
get_human_readable_string()
¶
Print the reason for which a validation has failed.
This is usually not a ViatException subclass,
so the default implementation would ignore the cause.
Source code in src/viat/exceptions.py
ViatAttributeStorageError
¶
ViatAttributeStorageWarning
¶
Bases: ViatWarning
Generic warning class for storage-related issues.
Source code in src/viat/exceptions.py
ViatCliError
¶
ViatConfigError
¶
ViatError
¶
ViatException
¶
ViatFileTrackerError
¶
ViatIntegrityError
¶
ViatMalformedStoredDataError
¶
Bases: ValidationExceptionMixin, ViatAttributeStorageError
Error class for malformed data.
Source code in src/viat/exceptions.py
ViatMissingAttributeError
¶
Bases: ViatAttributeStorageError, KeyError
Error class for missing attributes.
Parameters:
Source code in src/viat/exceptions.py
get_attr()
¶
ViatStoredDataValidationWarning
¶
Bases: ValidationExceptionMixin, ViatAttributeStorageWarning
Warning class for stored data that does not pass validation.
Parameters:
-
path(Path) –Path for which the stored data is not valid.
Source code in src/viat/exceptions.py
ViatUntrackedFileWarning
¶
Bases: ViatAttributeStorageWarning
Warning class for untracked files.
Source code in src/viat/exceptions.py
ViatValidationError
¶
Bases: ValidationExceptionMixin, ViatAttributeStorageError
Error class for schema validation failure.
Parameters:
-
path(Path) –Path for which the schema is not valid.
Source code in src/viat/exceptions.py
ViatVaultError
¶
ViatWarning
¶
emit_warning(warning, stacklevel)
¶
A wrapper around warnings.warn that processes intermediate handlers.
If any of the handlers return True, the next ones, including warnings.warn, are not processed.
Parameters:
-
warning(ViatWarning) –The warning to emit.
-
stacklevel(int) –A properly incremented stack level passed to the handlers.
Source code in src/viat/exceptions.py
install_warning_handler(handler)
¶
Install a new warning handler.
Parameters:
-
handler(Callable[[ViatWarning, int], bool | None]) –A function that accepts a warning and stacklevel.
If its return value is
True, we do not process the next handlers.
Source code in src/viat/exceptions.py
with_warning_handler(handler)
¶
Setup a warning handler in a context manager.
Parameters:
-
handler(Callable[[ViatWarning, int], bool | None]) –A function that accepts a warning and stacklevel.