Source code for revrt.exceptions
# ruff: noqa: N801, F401
"""Custom Exceptions and Errors for revrt"""
import logging
from revrt._rust import revrtRustError
logger = logging.getLogger("revrt")
[docs]
class revrtError(Exception):
"""Generic revrt Error"""
def __init__(self, *args, **kwargs):
"""Init exception and broadcast message to logger"""
super().__init__(*args, **kwargs)
if args:
logger.error(
"<%s> %s", self.__class__.__name__, args[0], stacklevel=2
)
[docs]
class revrtAttributeError(revrtError, AttributeError):
"""revrt AttributeError"""
[docs]
class revrtConfigurationError(revrtError, ValueError):
"""revrt ConfigurationError"""
[docs]
class revrtFileExistsError(revrtError, FileExistsError):
"""revrt FileExistsError"""
[docs]
class revrtFileNotFoundError(revrtError, FileNotFoundError):
"""revrt FileNotFoundError"""
[docs]
class revrtKeyError(revrtError, KeyError):
"""revrt KeyError"""
[docs]
class revrtNotImplementedError(revrtError, NotImplementedError):
"""revrt NotImplementedError"""
[docs]
class revrtProfileCheckError(revrtError, ValueError):
"""revrt Geotiff Profile Check Error"""
[docs]
class revrtRuntimeError(revrtError, RuntimeError):
"""revrt RuntimeError"""
[docs]
class revrtLeastCostPathNotFoundError(revrtRuntimeError):
"""revrt LeastCostPathNotFoundError"""
[docs]
class revrtTypeError(revrtError, TypeError):
"""revrt TypeError"""
[docs]
class revrtValueError(revrtError, ValueError):
"""revrt ValueError"""
[docs]
class revrtInvalidStartCostError(revrtValueError):
"""revrt revrtInvalidStartCostError"""