Use "pre-wrap" format and monospace font for exception messages#1925
Conversation
Ruby 3.1's error_highlight feature prints a code snippet with a underline. To make it readable, an exception message should be rendered by a monospace font and in "pre" format, i.e., whitespaces are preserved and newlines are respected.
|
I like this change, but what happens when the exception message is very long? We don't want this to require horizontal scrolling. One approach would be to use monospace font, but turn newlines into |
... to allow automatic line wrapping for very long lines.
|
@jeremyevans Thank you for your review!
It's a fair point. I changed the css to |
jeremyevans
left a comment
There was a problem hiding this comment.
pre-wrap looks like a good approach.
|
Thanks! This is better than what we currently have, so I'll merge it. But I'd personally like to see better formatting when dealing with HTML as an output. Seems like we we could do a lot better and I imagine lots of people are consuming error messages this way. |
This PR makes
Rack::ShowExceptionsfriendly to Ruby 3.1's error_highlight. An exception message should be rendered by a monospace font and in "pre" format, i.e., whitespaces are preserved and newlines are respected.Before:
After: