aboutsummaryrefslogtreecommitdiffstats
path: root/slack/python_compatibility.py
diff options
context:
space:
mode:
Diffstat (limited to 'slack/python_compatibility.py')
-rw-r--r--slack/python_compatibility.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/slack/python_compatibility.py b/slack/python_compatibility.py
index 1590894..e96b8af 100644
--- a/slack/python_compatibility.py
+++ b/slack/python_compatibility.py
@@ -1,3 +1,7 @@
+import traceback
+from typing import List
+
+
# Copied from https://peps.python.org/pep-0616/ for support for Python < 3.9
def removeprefix(self: str, prefix: str) -> str:
if self.startswith(prefix):
@@ -12,3 +16,7 @@ def removesuffix(self: str, suffix: str) -> str:
return self[: -len(suffix)]
else:
return self[:]
+
+
+def format_exception(exc: BaseException) -> List[str]:
+ return traceback.format_exception(type(exc), exc, exc.__traceback__)