-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.py
More file actions
47 lines (45 loc) · 1.26 KB
/
errors.py
File metadata and controls
47 lines (45 loc) · 1.26 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from flask_restful import HTTPException
class InvalidPhoneNumberError(HTTPException):
pass
class NameEmptyError(HTTPException):
pass
class EmailEmptyError(HTTPException):
pass
class DBInsertError(HTTPException):
pass
class DBQueryError(HTTPException):
pass
class UserNotFound(HTTPException):
pass
CUSTOM_ERRORS = {
"NameEmptyError": {
"message" : "Name cannot be empty.",
"success" : "false",
"status" : 401,
},
"InvalidPhoneNumberError": {
"message": "Phone number doesn't contain 10 digits. Please verify and re-enter!",
"success" : "false",
"status": 401,
},
"EmailEmptyError": {
"message": "Email cannot be empty. Please fill it up.",
"success" : "false",
"status": 401,
},
"DBInsertError": {
"message": "Unable to insert into database.",
"success" : "false",
"status": 402,
},
"DBQueryError": {
"message": "Unable to query user from database",
"success" : "false",
"status": 402,
},
"UserNotFound": {
"message": "Specified User entry and registered phone number not found in database. Try the Signup option to register the same.",
"success" : "false",
"status": 403,
},
}