aboutsummaryrefslogtreecommitdiffstats
path: root/slack/task.py
diff options
context:
space:
mode:
authorTrygve Aaberge <trygveaa@gmail.com>2023-01-28 19:27:31 +0100
committerTrygve Aaberge <trygveaa@gmail.com>2024-02-18 11:32:53 +0100
commit9b726746265f1d0a57e1b211934aa07a9cfdc712 (patch)
tree65b578adac0ea842c602d0c280e52dfd5e90a710 /slack/task.py
parent55643a7088e4fa8e7b5fd0aea62021975da6a4f0 (diff)
downloadwee-slack-9b726746265f1d0a57e1b211934aa07a9cfdc712.tar.gz
Fix task exception handling
Diffstat (limited to 'slack/task.py')
-rw-r--r--slack/task.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/slack/task.py b/slack/task.py
index 0e73a16..5b3ebfd 100644
--- a/slack/task.py
+++ b/slack/task.py
@@ -100,10 +100,17 @@ def task_runner(task: Task[Any], response: Any):
process_ended_task(task, result)
if isinstance(result, BaseException):
- create_task_in_stack = "create_task" in [
+ weechat_task_cb_in_stack = "weechat_task_cb" in [
stack.name for stack in traceback.extract_stack()
]
- if not in_active_tasks and not create_task_in_stack:
+ create_task_in_stack = [
+ stack.name for stack in traceback.extract_stack()
+ ].count("create_task")
+ if not in_active_tasks and (
+ create_task_in_stack == 0
+ or not weechat_task_cb_in_stack
+ and create_task_in_stack == 1
+ ):
if isinstance(e, HttpError):
print_error(
f"Error calling URL {e.url}: return code: {e.return_code}, "