8000 Fix rich escaping for errors by mattrasmus · Pull Request #124 · insitro/redun · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Dismiss alert

Fix rich escaping for errors #124

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 29, 2025
Merged

Fix rich escaping for errors #124

merged 1 commit into from
May 29, 2025

Conversation

mattrasmus
Copy link
Collaborator
@mattrasmus mattrasmus commented May 29, 2025

Fixes #122

Previously missed escaping errors when displaying redun console.

The brackets in [FileNotFoundError] from the example were not being escaped before being processed by rich.

Here is what the fix looks like. Error is probably displayed and Traceback header is bold.

Screenshot 2025-05-28 at 7 39 54 PM


lines = ["", "[bold]Traceback:[/]"]
if isinstance(error_value, ErrorValue) and error_value.traceback:
for line in error_value.traceback.format():
lines.append(line.rstrip("\n"))
traceback = [Static(rich_escape("\n".join(lines)))]
lines.append(rich_escape(line.rstrip("\n")))
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another bug was I was escaping "[bold]Traceback:[/]" as well, which should not be escaped.

@mattrasmus mattrasmus requested a review from pkaleta May 29, 2025 02:45
@mattrasmus mattrasmus merged commit 4bf313a into main May 29, 2025
10 checks passed
@mattrasmus mattrasmus deleted the fix-rich-escape2 branch May 29, 2025 03:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Redun console crashes with textual 3.2.0 when inspecting task which failed with FileNotFoundError
2 participants
0