-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathErrors.py
More file actions
32 lines (27 loc) · 1.01 KB
/
Errors.py
File metadata and controls
32 lines (27 loc) · 1.01 KB
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
import sys
def checkEvent(evt, context):
from . Signal import EventValue
if not isinstance(evt, EventValue):
print("Error: " + str(evt) + " is not an event value in " + context)
sys.exit()
return
def badKeyName(n):
print(str(n) + " is not a valid key name")
sys.exit()
def errorOnStaticTypes(func, correct, y):
print(func + " of " + correct + " bad argument: " + str(y))
sys.exit()
def checkNumArgs(expected, got, obj, attr):
#print(str(expected) + " " + str(got))
if expected is 0 or expected is got:
return
else:
if hasattr(obj, '_name'):
name = obj._name
else:
name = str(obj)
print("in " + str(name) + ", attribute " + str(attr) + ", expected: " + str(expected) + " args, but recieved: " + str(got) + " args")
sys.exit()
def typeError(expected, got, name, attr):
print("in " + str(name) + ", attribute " + str(attr) + ", expected: " + str(expected) + ", but recieved: " + str(got))
sys.exit()