-
Notifications
You must be signed in to change notification settings - Fork 723
fix: return PanicErrors #4294
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
base: main
Are you sure you want to change the base?
fix: return PanicErrors #4294
Conversation
Signed-off-by: Keith Zantow <[email protected]>
Signed-off-by: Keith Zantow <[email protected]>
| return errors.Join(out...) | ||
| } | ||
| // handle PanicErrors directly, since these are wrapped errors | ||
| if e, ok := err.(sync.PanicError); ok { |
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.
nit: why not errors.As?
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.
This function recursively unwraps errors, it doesn't need to let errors.As also do this
| prefix := strings.TrimSuffix(err.Error(), wrapped.Error()) | ||
| return fmt.Errorf("%s%w", prefix, got) | ||
| // if there is not a wrapped error, fall through to visit the error directly | ||
| if wrapped != nil { |
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.
nit / non-blocking: this would be a little more readable with a guard clause instead of wrapping (e.g. instead do if wrapped == nil { return nil} ahead of the remaining logic.)
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.
It's a little different behavior than this -- if wrapped is nil, it continues to visit the container
Description
This PR updates the
go-synclibrary to return panics as errors during concurrent calls, and adds an option to loudly log, but not fail on errors. This option will allow users to opt in to behavior in their CI environment, for example, that errors including panics will not cause the process to return nonzero, but instead only be error logged.Type of change
Checklist:
TODO:
--continue-on-erroror similar