aboutsummaryrefslogtreecommitdiffstats
path: root/modules/errors.py
diff options
context:
space:
mode:
authorhako-mikan <122196982+hako-mikan@users.noreply.github.com>2024-02-09 14:17:40 +0000
committerGitHub <noreply@github.com>2024-02-09 14:17:40 +0000
commit0bc7867ccd4ac24f5f270cb767c4642d0a0c001c (patch)
tree2ad13a0cf77bc189a8c9097bd507f9674f993da6 /modules/errors.py
parent816096e642187a18b11e2729c42c0b5f677f047d (diff)
parentcf2772fab0af5573da775e7437e6acdca424f26e (diff)
downloadstable-diffusion-webui-gfx803-0bc7867ccd4ac24f5f270cb767c4642d0a0c001c.tar.gz
stable-diffusion-webui-gfx803-0bc7867ccd4ac24f5f270cb767c4642d0a0c001c.tar.bz2
stable-diffusion-webui-gfx803-0bc7867ccd4ac24f5f270cb767c4642d0a0c001c.zip
Merge branch 'AUTOMATIC1111:master' into master
Diffstat (limited to 'modules/errors.py')
-rw-r--r--modules/errors.py18
1 files changed, 16 insertions, 2 deletions
diff --git a/modules/errors.py b/modules/errors.py
index 8c339464..eb234a83 100644
--- a/modules/errors.py
+++ b/modules/errors.py
@@ -6,6 +6,21 @@ import traceback
exception_records = []
+def format_traceback(tb):
+ return [[f"{x.filename}, line {x.lineno}, {x.name}", x.line] for x in traceback.extract_tb(tb)]
+
+
+def format_exception(e, tb):
+ return {"exception": str(e), "traceback": format_traceback(tb)}
+
+
+def get_exceptions():
+ try:
+ return list(reversed(exception_records))
+ except Exception as e:
+ return str(e)
+
+
def record_exception():
_, e, tb = sys.exc_info()
if e is None:
@@ -14,8 +29,7 @@ def record_exception():
if exception_records and exception_records[-1] == e:
return
- from modules import sysinfo
- exception_records.append(sysinfo.format_exception(e, tb))
+ exception_records.append(format_exception(e, tb))
if len(exception_records) > 5:
exception_records.pop(0)