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.

11 lines
441 B

2 years ago
2 years ago
  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 {"filename": self.filename, "line": self.line_num, "message": self.message}