-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Feature:(issue_1090): Add unwrap for ExitCoder #1545
Conversation
var err error | ||
|
||
switch e := message.(type) { | ||
case ErrorFormatter: |
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.
Is there any difference between this and the default handling?
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.
Well ErrorFormatter implies that the error message can be formatted dfferently than a "regular" error.
switch e := message.(type) { | ||
case ErrorFormatter: | ||
err = fmt.Errorf("%+v", message) | ||
case error: | ||
err = e | ||
default: | ||
err = fmt.Errorf("%+v", message) | ||
} |
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.
Well ErrorFormatter implies that the error message can be formatted dfferently than a "regular" error.
Buf the handling of ErrorFormatter same as default
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.
Yes. So what do you suggest be done ? I can collapse the ErrorFormatter into default.
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.
Actually collapsing ErrorFormatter into default doesnt seem to work. I'm going to leave it as it is.
What type of PR is this?
(REQUIRED)
What this PR does / why we need it:
(REQUIRED)
Which issue(s) this PR fixes:
(REQUIRED)
Fixes #1090
Special notes for your reviewer:
(fill-in or delete this section)
Testing
make test
(fill-in or delete this section)
Release Notes
(REQUIRED)