Replies: 3 comments 4 replies
-
So you make the exceptions themselves renderable? I do something similar in Textual. I guess you always want the traceback, but with the exception rendered if it is renderable? |
Beta Was this translation helpful? Give feedback.
4 replies
-
OK, I finally came around to this. #3325 is the PR, and it works! |
Beta Was this translation helpful? Give feedback.
0 replies
-
Also I've filed #3324 -- a somewhat-unrelated PR that cleans up some dead code from traceback tests. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In a few of the projects I've been working on (pip, sphinx-theme-builder and more), I have been creating "rich-aware" errors -- i.e. these error objects are
RichRenderable
, by implementing the__rich_console__
/__rich__
methods.It would be really nice if
rich.traceback
were to use the "rich" representation of those errors (falling back to<error rendering {exc.__class__.__name__}>
, like it does withstr
calls currently).This would make it possible to switch to using Rich's traceback handler exclusively, allowing for nicer tracebacks for users while still presenting the
RichRenderable
exception objects in a pretty manner, instead of degrading those to plain strings. :)Beta Was this translation helpful? Give feedback.
All reactions