Source code for kvalikirstu2.exceptions
"""A module containing exceptions.
"""
[docs]class TempFileException(Exception):
"""An exception for generating temp files
:var inner_exception: The inner exception thrown during the generation of the temp files.
"""
def __init__(self, exception, *args, **kwargs):
self.inner_exception = exception
super().__init__(str(exception), *args, **kwargs)
def __str__(self):
return str(self.inner_exception)
[docs]class ParagraphParsingException(Exception):
"""Error occurred during parsing paragraphs.
:var temp_path: Path of the temp file.
:var row_min: The first row where the error occurs.
:var row_max: The last row where the error occurs.
:var msg: The error message.
"""
def __init__(self, temp_path, row_min, row_max, msg=""):
super().__init__()
self.temp_path = temp_path
self.row_min = row_min
self.row_max = row_max
self.msg = msg
def __str__(self):
return self.msg
[docs]class EncodingError(Exception):
"""Error occurred related to text encoding"""
def __init__(self, filepath, msg):
super(Exception, self).__init__(msg)
self.filepath = filepath