File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -201,6 +201,7 @@ def check_errors(keywords, *path):
201
201
return None
202
202
203
203
def get_error_status_code (error ):
204
+ print (error )
204
205
return error ["extensions" ]["exception" ]["status" ]
205
206
206
207
if check_errors (["AUTHENTICATION_ERROR" ], "extensions" ,
@@ -255,6 +256,12 @@ def get_error_status_code(error):
255
256
else :
256
257
raise labelbox .exceptions .InternalServerError (message )
257
258
259
+ not_allowed_error = check_errors (["OPERATION_NOT_ALLOWED" ],
260
+ "extensions" , "code" )
261
+ if not_allowed_error is not None :
262
+ message = not_allowed_error .get ("message" )
263
+ raise labelbox .exceptions .OperationNotAllowedException (message )
264
+
258
265
if len (errors ) > 0 :
259
266
logger .warning ("Unparsed errors on query execution: %r" , errors )
260
267
raise labelbox .exceptions .LabelboxError ("Unknown error: %s" %
Original file line number Diff line number Diff line change @@ -112,4 +112,9 @@ class InconsistentOntologyException(Exception):
112
112
113
113
class MALValidationError (LabelboxError ):
114
114
"""Raised when user input is invalid for MAL imports."""
115
- ...
115
+ pass
116
+
117
+
118
+ class OperationNotAllowedException (Exception ):
119
+ """Raised when user does not have permissions to a resource or has exceeded usage limit"""
120
+ pass
You can’t perform that action at this time.
0 commit comments