aboutsummaryrefslogtreecommitdiffstats
path: root/slack/error.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-08-25 17:28:21 +0200
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:54 +0100
commit74b6bf4a8117b446907e45a88fe2e7f06ece29db (patch)
tree79babb2fb678244883817153c7cc2e10467eb4a1 /slack/error.py
parentfe3288e1aa8e9a497004d354bb674a26923f0b61 (diff)
downloadwee-slack-74b6bf4a8117b446907e45a88fe2e7f06ece29db.tar.gz
Support rendering files
Diffstat (limited to 'slack/error.py')
-rw-r--r--slack/error.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/slack/error.py b/slack/error.py
index 1a13504..7a38f29 100644
--- a/slack/error.py
+++ b/slack/error.py
@@ -2,7 +2,7 @@ from __future__ import annotations
from dataclasses import dataclass, field
from datetime import datetime
-from typing import TYPE_CHECKING, Dict, Mapping, Sequence, Union
+from typing import TYPE_CHECKING, Dict, Mapping, Optional, Sequence, Union
from uuid import uuid4
from slack.python_compatibility import format_exception_only
@@ -70,12 +70,15 @@ class SlackRtmError(Exception):
class SlackError(Exception):
- def __init__(self, workspace: SlackWorkspace, error: str):
+ def __init__(
+ self, workspace: SlackWorkspace, error: str, data: Optional[object] = None
+ ):
super().__init__(
f"{self.__class__.__name__}: workspace={workspace}, error={error}"
)
self.workspace = workspace
self.error = error
+ self.data = data
@dataclass
@@ -92,9 +95,13 @@ def format_exception_only_str(exc: BaseException) -> str:
return format_exception_only(exc)[-1].strip()
+def store_uncaught_error(uncaught_error: UncaughtError) -> None:
+ shared.uncaught_errors.append(uncaught_error)
+
+
def store_and_format_uncaught_error(uncaught_error: UncaughtError) -> str:
+ store_uncaught_error(uncaught_error)
e = uncaught_error.exception
- shared.uncaught_errors.append(uncaught_error)
stack_msg_command = f"/slack debug error {uncaught_error.id}"
stack_msg = f"run `{stack_msg_command}` for the stack trace"