errors: show location before the message

This commit is contained in:
Antoine Viallon 2023-05-24 00:12:36 +02:00
parent 717bd60e86
commit 1e9843ec0e
Signed by: aviallon
GPG key ID: D126B13AB555E16F

View file

@ -7,7 +7,7 @@ from . import source, lexer
class CompilationError(Exception):
def __init__(self, location: source.SourceLocation, message: str = "Unknown error"):
super().__init__(f"{message} at {str(location)}")
super().__init__(f"{str(location)}: {message} ")
self.location = location