-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi_errors.py
More file actions
55 lines (48 loc) · 1.4 KB
/
api_errors.py
File metadata and controls
55 lines (48 loc) · 1.4 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
48
49
50
51
52
53
54
55
class ApiError(Exception):
def __init__(self, status_code, error, description):
self.status_code = status_code
self.error = error
self.description = description
def to_dict(self):
return {
"status_code": self.status_code,
"error": self.error,
"description": self.description
}
class CheckResult(Exception):
def __init__(self, status_code, success, gh_user, message):
self.status_code = status_code
self.success = success
self.gh_user = gh_user
self.message = message
def to_dict(self):
return {
"status_code": self.status_code,
"success": self.success,
"github_user": self.gh_user,
"message": self.message
}
not_enough_permissions = ApiError(
403,
"not_enough_permissions",
"The code passed doesn't grant enough permissions, 'user:email' scope is required"
)
code_not_provided = ApiError(
400,
"code_not_provided",
"No code was passed in the query string"
)
esi_email_not_found = CheckResult(
401,
False,
"",
"ESI email not found, to join ESIHub org you must add your @esi.dz email \
to your Github account"
)
esi_email_not_verified = CheckResult(
401,
False,
"",
"ESI email not verified, to join ESIHub org you must verify your @esi.dz email \
in your Github account"
)