improves exception output
This commit is contained in:
parent
2a2a26977a
commit
d2c41b6670
1 changed files with 7 additions and 4 deletions
11
over/app.py
11
over/app.py
|
@ -741,24 +741,27 @@ class Main:
|
||||||
# if there's a "self" in locals, we can get a hold of the method using getattr
|
# if there's a "self" in locals, we can get a hold of the method using getattr
|
||||||
if "self" in frame.f_locals:
|
if "self" in frame.f_locals:
|
||||||
method = getattr(frame.f_locals["self"], method_name)
|
method = getattr(frame.f_locals["self"], method_name)
|
||||||
method_display_name = "<c>%s<.>.<y>%s<.>" %(method.__self__.__class__.__name__, method_name)
|
method_display_name = " <c>%s<.>.<y>%s<.>" %(method.__self__.__class__.__name__, method_name)
|
||||||
method_type = "method"
|
method_type = "method"
|
||||||
|
|
||||||
# if it's a global function, it's likely going to be here
|
# if it's a global function, it's likely going to be here
|
||||||
elif method_name in frame.f_globals:
|
elif method_name in frame.f_globals:
|
||||||
method = frame.f_globals[method_name]
|
method = frame.f_globals[method_name]
|
||||||
method_display_name = "<y>%s<.>" %(method_name)
|
method_display_name = " <y>%s<.>" %(method_name)
|
||||||
method_type = "function"
|
method_type = "function"
|
||||||
|
|
||||||
# otherwise give up
|
# otherwise give up
|
||||||
else:
|
else:
|
||||||
method = None
|
method = None
|
||||||
method_display_name = "<y>%s<.>" %(method_name)
|
method_display_name = ""
|
||||||
|
|
||||||
if method_name == "<module>":
|
if method_name == "<module>":
|
||||||
method_type = "module"
|
method_type = "module"
|
||||||
|
elif method_name == "<genexpr>":
|
||||||
|
method_type = "a generator expression"
|
||||||
else:
|
else:
|
||||||
method_type = "<r>unknown callable<.>"
|
method_type = "<r>unknown callable<.>"
|
||||||
|
method_display_name = " <y>%s<.>" %(method_name)
|
||||||
|
|
||||||
# use a docstring-provided action description if available
|
# use a docstring-provided action description if available
|
||||||
if method and method.__doc__ and "@while" in method.__doc__:
|
if method and method.__doc__ and "@while" in method.__doc__:
|
||||||
|
@ -766,7 +769,7 @@ class Main:
|
||||||
else:
|
else:
|
||||||
action = ""
|
action = ""
|
||||||
|
|
||||||
tb_lines.append("%sin %s <y>%s<.> at %s:%d," %(action, method_type, method_display_name, frame.f_code.co_filename, frame.f_lineno))
|
tb_lines.append("%sin %s%s at %s:%d," %(action, method_type, method_display_name, frame.f_code.co_filename, frame.f_lineno))
|
||||||
|
|
||||||
if hasattr(exception, "description"):
|
if hasattr(exception, "description"):
|
||||||
reason = ": <R>%s<.>" %(exception.description)
|
reason = ": <R>%s<.>" %(exception.description)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue