benchling_sdk.apps.status.errors module¶
- exception AppUserFacingError¶
Bases:
Exception
App User Facing Error.
Extend this class with custom exceptions you want to be written back to the user as a SessionMessage.
SessionClosingContextExitHandler will invoke messages() and write them to a user. Callers choosing to write their own SessionContextExitHandler may need to replicate this behavior themselves.
This is useful for control flow where an app wants to terminate with an error state that is resolvable by the user.
For example:
- class InvalidUserInputError(AppUserFacingError):
pass
raise InvalidUserInputError(“Please enter a number between 1 and 10”)
This would create a message shown to the user like:
AppSessionMessageCreate(“Please enter a number between 1 and 10”, style=AppSessionMessageStyle.ERROR)
- __init__(messages: Union[str, List[str]], *args) None ¶
Initialize an AppUserFacingError with one message or a list.
- messages() List[AppSessionMessageCreate] ¶
Create a series of AppSessionMessageCreate to write to a Session and displayed to the user.
- exception InvalidSessionTimeoutError¶
Bases:
Exception
Invalid Session Timeout Error.
A session’s timeout value was set to an invalid value.
- exception MissingAttachedCanvasError¶
Bases:
Exception
Missing Attached Canvas Error.
A canvas operation was requested, but a session context has no attached canvas.