Skip to content
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.

Deprecate wrapping of errors with errio.Error() #224

Closed
wants to merge 1 commit into from

Conversation

jpcoenen
Copy link
Member

The wrapping leads to appending "An unexpected error occurred [...]" to many errors, even ones that are relatively simple. The only way to avoid this, is to return all errors as errrio.PublicError; this does not work well togehter with the error paradigm introduced in Go 1.13.

The wrapping leads to appending "An unexpected error occurred [...]" to many errors, even ones that are relatively simple. The only way to avoid this, is to return all errors as errrio.PublicError; this does not work well togehter with the error paradigm introduced in Go 1.13.
return err
}
return UnexpectedError(err)
return err
Copy link
Member

Choose a reason for hiding this comment

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

Not sure if we should change the behavior as well. Should we just deprecate and stop calling the function where we need the changed behavior?

One might depend on the returned type being UnexpectedError, as this was explicitly documented and a separate test case exists for this, TestUnexpectedError.

@jpcoenen
Copy link
Member Author

jpcoenen commented Jan 5, 2021

Had to consider @SimonBarendse thought for a few times. In the end, I think there is an easy solution that keeps the current exported behaviour by leveraging Unwrap(). Opened a separate PR for that: #226

@jpcoenen jpcoenen closed this Jan 5, 2021
@jpcoenen jpcoenen deleted the feature/remove-error-wrapping branch January 5, 2021 09:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants