Open ibro45 opened 9 months ago
or, alternatively, add an option to just shorten the error messages of the already suppressed modules. That won't be as complex and will probably be just enough amount of control -- in my case, that would actually be perfect.
How would you improve Rich?
Allow automatic shortening of error messages. Could be implemented similarly to frame suppression. A shortened message would keep only, for example, 3 lines, and the number of lines could be controlled similarly to
max_frames
inTraceback
What problem does it solve for you?
Chained exceptions can get quite long in frameworks that build on top of several other codebases. The error messages in some of the exceptions in the chain can be almost certainly always useless. Shortening them would make debugging way simpler.
In my framework, I would by default have certain modules' error messages shortened/supressed automatically, unless the debug mode is activated.
For example, the RuntimeError here:
Would become this if
max_error_lines=3
(or whatever the name would be):Alternative Please let me know if there is already a way to achieve this. Also, if this is something that you would indeed like to have, feel free to briefly instruct me in how it could be achieved and I would be happy to try to make a pull request.