1616 data element involved in the error.
1717 data - optional data element that provides an id or key value
1818 for the data set being processed when the error occurred.
19-
19+
20+ The HTTP error code indicates whether the request succeeded or failed. If
21+ the call is successful, the service will return a code 200 and a message
22+ of "OK".
23+
24+ If the request is unsuccessful and the error is due to faulty client data,
25+ return an HTTP error code of 401 if the user is unknown or authentication fails.
26+ Return an HTTP 500 error if the failure is due to an issue within the server,
27+ such as unable to access the back-end database.
28+
2029'''
2130
2231
@@ -27,7 +36,7 @@ def unknown_user_id(id_user):
2736 'message' : 'Unknown user' ,
2837 'code' : 400 ,
2938 'data' : id_user
30- }, 500
39+ }, 400
3140
3241
3342def unknown_user_email (email ):
@@ -37,7 +46,7 @@ def unknown_user_email(email):
3746 'message' : 'Unknown user' ,
3847 'code' : 400 ,
3948 'data' : email
40- }, 500
49+ }, 400
4150
4251
4352def unknown_user_screen_name (screen_name ):
@@ -47,7 +56,7 @@ def unknown_user_screen_name(screen_name):
4756 'message' : 'Unknown user screen name' ,
4857 'code' : 400 ,
4958 'data' : screen_name
50- }, 500
59+ }, 400
5160
5261
5362def email_already_in_use (email ):
@@ -57,7 +66,7 @@ def email_already_in_use(email):
5766 'message' : 'Email already in use' ,
5867 'code' : 450 ,
5968 'data' : email
60- }, 500
69+ }, 400
6170
6271
6372def email_not_confirmed (email ):
@@ -77,7 +86,7 @@ def user_blocked(email):
7786 'message' : 'User is blocked' ,
7887 'code' : 420 ,
7988 'data' : email
80- }, 401
89+ }, 403
8190
8291
8392def not_a_number (field , value ):
@@ -97,7 +106,7 @@ def passwords_do_not_match():
97106 'success' : False ,
98107 'message' : "Password confirm doesn't match" ,
99108 'code' : 460
100- }, 500
109+ }, 400
101110
102111
103112def password_complexity ():
@@ -106,7 +115,7 @@ def password_complexity():
106115 'success' : False ,
107116 'message' : "Password is not complex enough" ,
108117 'code' : 490
109- }, 500
118+ }, 400
110119
111120
112121def screen_name_already_in_use (screen_name ):
@@ -116,7 +125,7 @@ def screen_name_already_in_use(screen_name):
116125 'message' : "Screenname already in use" ,
117126 'code' : 500 ,
118127 'data' : screen_name
119- }, 500
128+ }, 400
120129
121130
122131def rate_exceeded (time ):
@@ -131,7 +140,7 @@ def rate_exceeded(time):
131140 'message' : 'Insufficient bucket tokens' ,
132141 'code' : 470 ,
133142 'data' : time
134- }, 500
143+ }, 400
135144
136145
137146def wrong_password (email ):
@@ -151,7 +160,7 @@ def unknown_bucket_type(bucket_type):
151160 'message' : 'Unknown bucket type' ,
152161 'code' : 180 ,
153162 'data' : bucket_type
154- }, 500
163+ }, 400
155164
156165
157166def wrong_auth_source (auth_source ):
0 commit comments