From 8eed09c14b2c89d21b2887afbfee90ed0668c0d2 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sat, 28 Aug 2021 14:58:11 -0700 Subject: [PATCH] Specifically state that the exception killed the log context. --- voussoirkit/operatornotify.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/voussoirkit/operatornotify.py b/voussoirkit/operatornotify.py index e283b72..2e2bf40 100644 --- a/voussoirkit/operatornotify.py +++ b/voussoirkit/operatornotify.py @@ -162,7 +162,10 @@ class LogHandlerContext: if exc_type not in (None, KeyboardInterrupt): exc_text = traceback.format_exception(exc_type, exc_value, exc_traceback) exc_text = ''.join(exc_text) - exc_text = f'\n{exc_text}\n' + exc_text = '\n'.join([ + 'The context was killed by the following exception:', + f'{exc_text}' + ]) # Intentionally using module's log, not self.log because I think # it should be clear who emitted the message, and the caller can # mute this module if they want to.