-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexceptions.py
31 lines (24 loc) · 1.12 KB
/
exceptions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
class SocraticSyntaxError(Exception):
def __init__(self, desc):
self.desc = desc
super().__init__(str(desc))
def __str__(self): return f"SyntaxError: {self.desc}"
def __repr__(self): return str(self)
class UnresolvedRelationException(Exception):
def __init__(self, rel):
self.rel = rel
super().__init__(str(self))
def __str__(self): return f"Could not resolve relation because none of {self.rel} has a known value"
def __repr__(self): return str(self)
class UndefinedVariableException(Exception):
def __init__(self, name, rels):
self.name = name
self.rels = rels
super().__init__(str(self))
def __str__(self): return f"Could not get variable {self.name}, since it has no definitions and is only related to {self.rels}"
class InternalErrorException(Exception):
def __init__(self, desc):
self.desc = desc
super().__init__(str(self))
def __str__(self): return f"Internal Error: {self.desc}\nThis is likely not because of anything you did but was probably a bug in the SocratesPy itself"
def __repr__(self): return str(self)