-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
[TF-11813] do not colorize runHeader when returned as err #34473
Conversation
2e10cd7
to
a34812c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❔ 👇
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some peculiar things about this error that I feel compelled to point out that make this bug fix a little less than straightforward.
We are colorizing (that is, replace [color] codes with terminal escape sequences that produce color in a terminal) the text of an error message and returning it as an error type.
The original intent of the error diagnostics are to basically format errors like this:
Specifically, a red bar prefixing a red label "Error:", followed by a white summary, followed by gray details.
By injecting escape codes into the details, we're hacking the error and overriding the intend of the diagnostics output.
If this error were instead used in JSON output, or just logged, or anything other than being displayed in the terminal, the escape characters wouldn't make sense and it would come out like { "error": { "details": "\x1b[1;33mTo view this run in a browser,..." }}
Maybe a better solution is to return an error message that does not "hack" the terminal, which may mean using a string that is not runHeader
3ed0e0c
to
048818b
Compare
d28f9b9
to
6d9b3b2
Compare
Reminder for the merging maintainer: if this is a user-visible change, please update the changelog on the appropriate release branch. |
I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active contributions. |
changelog added via #34715 |
Fixes #
We should not call colorize on strings that are returned as error messages.
Target Release
1.5.x
Draft CHANGELOG entry
NEW FEATURES | UPGRADE NOTES | ENHANCEMENTS | BUG FIXES | EXPERIMENTS
Before
After