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
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions internals/errio/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,10 @@ func StatusError(err error) error {
return UnexpectedStatusError(err)
}

// Error can be called to on any error to convert it to a PublicError if it is not already.
// If it is not yet a PublicError, an UnexpectedError is returned
// Error returns the inputted error.
// Deprecated: this leads to unwanted returns of UnexpectedErrrors and should therefor not be used anymore.
func Error(err error) error {
if err == nil {
return nil
}

if isPublicError(err) || isPublicStatusError(err) {
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.

}

// IsKnown checks whether the given error is known.
Expand Down