-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexceptions.py
41 lines (32 loc) · 928 Bytes
/
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
32
33
34
35
36
37
38
39
40
41
"""
Application Errors
"""
class ApplicationError(Exception):
def __init__(self, message, code):
self.message = message
self.code = code
super(Exception, self).__init__(message)
class InvalidJSON(ApplicationError):
def __init__(self):
ApplicationError.__init__(self,
"No JSON object could be decoded.",
400
)
class AuthError(ApplicationError):
def __init__(self):
ApplicationError.__init__(self,
"User not authenticated",
401
)
class RouteNotFound(ApplicationError):
def __init__(self, action):
ApplicationError.__init__(self,
"%s route could not be found" % action,
404
)
class ServerError(ApplicationError):
def __init__(self):
ApplicationError.__init__(self,
"we screwed up and have some debugging to do",
500
)