1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
|
"""
This file is part of TexText, an extension for the vector
illustration program Inkscape.
Copyright (c) 2006-2025 TexText developers.
TexText is released under the 3-Clause BSD license. See
file LICENSE.txt or go to https://github.com/textext/textext
for full license details.
Provides Exception classes for error handling.
"""
class TexTextError(RuntimeError):
""" Basic class of all TexText errors"""
class TexTextNonFatalError(TexTextError):
""" TexText can continue execution properly """
pass
class TexTextCommandError(TexTextNonFatalError):
pass
class TexTextCommandNotFound(TexTextCommandError):
pass
class TexTextCommandFailed(TexTextCommandError):
def __init__(self, message, return_code, stdout=None, stderr=None):
super(TexTextCommandFailed, self).__init__(message)
self.return_code = return_code
self.stdout = stdout
self.stderr = stderr
class TexTextConversionError(TexTextCommandFailed):
def __init__(self, message, return_code=None, stdout=None, stderr=None):
super(TexTextConversionError, self).__init__(message, return_code, stdout, stderr)
class TexTextFatalError(TexTextError):
"""
TexText can't continue properly
Primary usage is assert-like statements:
if <condition>: raise FatalTexTextError(...)
Example: missing *latex executable
"""
pass
class TexTextInternalError(TexTextFatalError):
pass
class TexTextPreconditionError(TexTextInternalError):
pass
class TexTextPostconditionError(TexTextInternalError):
pass
class TexTextUnreachableBranchError(TexTextInternalError):
pass
class BadTexInputError(TexTextNonFatalError):
pass
|