1 from __future__ import annotations

2 from typing import TYPE_CHECKING

3

4 if TYPE_CHECKING:

5 from typing_extensions import Final

6

7

8 class ParseError(Exception):

9 path: Final[str]

10 lineno: Final[int]

11 msg: Final[str]

12

13 def __init__(self, path: str, lineno: int, msg: str) -> None:

14 super().__init__(path, lineno, msg)

15 self.path = path

16 self.lineno = lineno

17 self.msg = msg

18

19 def __str__(self) -> str:

20 return f"{self.path}:{self.lineno + 1}: {self.msg}"