Bases: FrontendProgramException
Exception type used when xDSL code generation fails. Should be used for
user-facing errors, e.g. unsupported functionality or failed type checks.
Source code in xdsl/frontend/pyast/utils/exceptions.py
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 | @dataclass
class CodeGenerationException(FrontendProgramException):
"""
Exception type used when xDSL code generation fails. Should be used for
user-facing errors, e.g. unsupported functionality or failed type checks.
"""
file: str | None
line: int
col: int
def __init__(
self,
file: str | None,
line: int,
col: int,
msg: str,
):
super().__init__(msg)
self.file = file
self.line = line
self.col = col
def __str__(self) -> str:
str = "Code generation exception at "
if self.file:
return (
str + f'"{self.file}", line {self.line} column {self.col}: {self.msg}'
)
else:
return str + f"line {self.line} column {self.col}: {self.msg}"
|
file: str | None = file
instance-attribute
line: int = line
instance-attribute
col: int = col
instance-attribute
__init__(file: str | None, line: int, col: int, msg: str)
Source code in xdsl/frontend/pyast/utils/exceptions.py
31
32
33
34
35
36
37
38
39
40
41 | def __init__(
self,
file: str | None,
line: int,
col: int,
msg: str,
):
super().__init__(msg)
self.file = file
self.line = line
self.col = col
|
__str__() -> str
Source code in xdsl/frontend/pyast/utils/exceptions.py
| def __str__(self) -> str:
str = "Code generation exception at "
if self.file:
return (
str + f'"{self.file}", line {self.line} column {self.col}: {self.msg}'
)
else:
return str + f"line {self.line} column {self.col}: {self.msg}"
|