From 8e1e2a9c547c19a2944a303193d6fc55505774e0 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Sun, 14 Jan 2024 18:56:20 +0100 Subject: [PATCH] Added debug function --- RNS/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/RNS/__init__.py b/RNS/__init__.py index 0e0b7a2..323439f 100755 --- a/RNS/__init__.py +++ b/RNS/__init__.py @@ -144,6 +144,12 @@ def rand(): result = instance_random.random() return result +def trace_exception(e): + import traceback + exception_info = "".join(traceback.TracebackException.from_exception(e).format()) + log(f"An unhandled {str(type(e))} exception occurred: {str(e)}", LOG_ERROR) + log(exception_info, LOG_ERROR) + def hexrep(data, delimit=True): try: iter(data)