Skip to content

Commit

Permalink
better exceptions?
Browse files Browse the repository at this point in the history
  • Loading branch information
sir-sigurd committed Jun 11, 2024
1 parent 9a70bac commit 7e4fe7c
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions api/python/quilt3/admin/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,20 @@ class User(BaseModel):
extra_roles: List[AnnotatedRole] = Field()


class UserNotFoundError(Exception):
pass
class Quilt3AdminError(Exception):
def __init__(self, details):
super().__init__(details)
self.details = details


class UserNotFoundError(Quilt3AdminError):
def __init__(self):
super().__init__(None)


def _handle_errors(result: BaseModel) -> Any:
if isinstance(result, (InvalidInputSelection, OperationErrorSelection)):
raise Exception(result) # TODO: Proper error handling
raise Quilt3AdminError(result)
return result


Expand Down

0 comments on commit 7e4fe7c

Please sign in to comment.