bot: show traceback in debug logs on unhandled exc
This commit is contained in:
parent
31d7cc4284
commit
5f7f5db0ff
|
@ -3,6 +3,8 @@ import json
|
|||
import os
|
||||
import time
|
||||
import signal
|
||||
import sys
|
||||
import traceback
|
||||
from pathlib import Path
|
||||
from typing import Any, Iterable, Optional
|
||||
|
||||
|
@ -123,8 +125,11 @@ class Bot(irc.client.SimpleIRCClient, Logger):
|
|||
self.start()
|
||||
except KeyboardInterrupt:
|
||||
self.log_i("Caught keyboard interrupt.")
|
||||
except Exception as exc: # Yes, I know, who are you going to call?
|
||||
except Exception as exc:
|
||||
self.log_c(f"Caught unhandled exception: {exc}")
|
||||
_, _, exc_traceback = sys.exc_info()
|
||||
for line in traceback.format_tb(exc_traceback):
|
||||
self.log_d(line.rstrip())
|
||||
finally:
|
||||
self.cleanup()
|
||||
|
||||
|
|
Loading…
Reference in a new issue