-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy patherror.py
48 lines (33 loc) · 878 Bytes
/
error.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python
# encoding: utf-8
"""
main.py
CS266 Ant Sim
"""
class Success(Exception):
def __init__(self, msg):
self.msg = msg
self.type = "Success"
def __str__(self):
return repr(self.type) + ": " + repr(self.msg)
class Error(Exception):
#base class for errors
pass
class SimulationError(Error):
#errors from running the physics simulator
def __init__(self, type, msg):
self.msg = msg
self.type = type
def __str__(self):
return repr(self.type) + ": " + repr(self.msg)
class WeirdError(Error):
#errors that really shouldn't happen
def __init__(self, msg):
self.msg = msg
def __str__(self):
return "WeirdError: " + repr(self.msg)
class BridgeFailure(Error):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return "BridgeFailure: " + repr(self.msg)