You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
488 B

  1. class FileParseException(Exception):
  2. def __init__(self, filename: str, line_num: int, message: str):
  3. self.filename = filename
  4. self.line_num = line_num
  5. self.message = message
  6. def __str__(self):
  7. return f'ParseError: You cannot parse line {self.line_num} in {self.filename}: {self.message}'
  8. def dict(self):
  9. return {
  10. 'filename': self.filename,
  11. 'line': self.line_num,
  12. 'message': self.message
  13. }