pawnlib.exceptions package
from pawnlib.exceptions import *
Submodules
pawnlib.exceptions.notifier module
from pawnlib.exceptions import notifier
- class ExceptionNotifier(logger=None, slack_status='failed', slack_msg_level='error', slack_icon=':alert:', slack_url=None)[source]
Bases:
LoggerMixinInitializes the ExceptionNotifier with logging and Slack notification settings.
- Parameters:
logger (optional) – Logger instance to log the error. |default|
Noneslack_status (optional) – Status type for Slack notification (default: ‘error’). |default|
'failed'slack_msg_level (optional) – Message level for Slack (default: ‘error’). |default|
'error'slack_icon (optional) – Emoji icon for Slack message (default: ‘:alert:’). |default|
':alert:'slack_url (optional) – The Slack webhook URL. If None, it will use the environment variable. |default|
None
- __init__(logger=None, slack_status='failed', slack_msg_level='error', slack_icon=':alert:', slack_url=None)[source]
Initializes the ExceptionNotifier with logging and Slack notification settings.
- Parameters:
logger (optional) – Logger instance to log the error. |default|
Noneslack_status (optional) – Status type for Slack notification (default: ‘error’). |default|
'failed'slack_msg_level (optional) – Message level for Slack (default: ‘error’). |default|
'error'slack_icon (optional) – Emoji icon for Slack message (default: ‘:alert:’). |default|
':alert:'slack_url (optional) – The Slack webhook URL. If None, it will use the environment variable. |default|
None
- notify_exception(e, logger=None, additional_message=None, slack_status='failed', slack_msg_level='error', slack_icon=':alert:', slack_url=None)[source]
A helper function to quickly notify an exception using the ExceptionNotifier.
- Parameters:
e – Exception object.
logger (optional) – Logger instance (optional). |default|
Noneadditional_message (optional) – Additional message to send along with the exception details (optional). |default|
Noneslack_status (optional) – Status type for Slack notification (default: ‘error’). |default|
'failed'slack_msg_level (optional) – Message level for Slack (default: ‘error’). |default|
'error'slack_icon (optional) – Emoji icon for Slack message (default: ‘:alert:’). |default|
':alert:'slack_url (optional) – Slack webhook URL. If None, it will use the environment variable (optional). |default|
None