pytex/errors/errors.py

36 lines
1.1 KiB
Python
Raw Normal View History

class PyTexError(Exception):
def __init__(self, message, *args, **kwargs):
self.message = message
def __str__(self):
return r'{prefix} ERROR: {message}'.format(
prefix='[PyTeX]',
message=self.message
)
class SubmoduleDirtyForbiddenError(PyTexError):
def __init__(self):
super().__init__(
"Submodule PyTeX is dirty, but writing dirty files is not allowed. "
"Call PyTeX with '--allow-dirty' option, or commit the submodule changes.")
class ExtraHeaderFileNotFoundError(PyTexError):
def __init__(self):
super().__init__('Path to extra header content is invalid.')
class ProgrammingError(PyTexError):
def __init__(self):
super().__init__("A FATAL programming error has occurred. Please contact the developer.")
class UnknownTexVersionError(PyTexError):
def __init__(self, tex_version: str):
super().__init__(
f"Unknown TeX version {tex_version}given. Only 'LaTeX2e' and 'LaTeX3' "
f"are currently supported"
)