tamaki.mes.permissions.notifyUserIfPermissionException
Description
A convenience handler for except blocks. If the exception is a permission exception, it opens the
non-modal TamakiMES/_popups/AccessDenied popup (showing the parsed message and the raw exception)
and returns True. If the exception is not a permission exception, it does nothing and returns
False, letting the caller handle other error types.
Because it opens a popup, this function must run in a Perspective session scope.
Syntax
tamaki.mes.permissions.notifyUserIfPermissionException(exception)
Parameters
| Parameter | Type | Nullable | Description |
|---|---|---|---|
exception | Exception | False | The caught exception. |
Returns
A Boolean: True if the exception was a permission exception and the Access Denied popup was
shown, otherwise False.
Code Examples
try:
system.mes.location.saveLocation(**location)
except Exception as e:
if not tamaki.mes.permissions.notifyUserIfPermissionException(e):
# Not an access-denied error: show the generic error popup instead
tamaki.mes.utils.showErrorPopup(e)
raise e