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):
201201 return None
202202
203203 def get_error_status_code (error ):
204+ print (error )
204205 return error ["extensions" ]["exception" ]["status" ]
205206
206207 if check_errors (["AUTHENTICATION_ERROR" ], "extensions" ,
@@ -255,6 +256,12 @@ def get_error_status_code(error):
255256 else :
256257 raise labelbox .exceptions .InternalServerError (message )
257258
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+
258265 if len (errors ) > 0 :
259266 logger .warning ("Unparsed errors on query execution: %r" , errors )
260267 raise labelbox .exceptions .LabelboxError ("Unknown error: %s" %
Original file line number Diff line number Diff line change @@ -112,4 +112,9 @@ class InconsistentOntologyException(Exception):
112112
113113class MALValidationError (LabelboxError ):
114114 """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