x/xerrors: retrieving original "wrapped" error should not depend on a verb #31432
Labels
FeatureRequest
Issues asking for a new feature that does not need a proposal.
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
N/A. Working off master.
What operating system and processor architecture are you using (
go env
)?go env
OutputCurrently using
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373
Suppose I have a function that internally calls
bufio
and somewhere an error occurs. I'd like to return the error with context:pkg/error:
golang.org/x/xerrors:
presumably the above would be equivalent to:
So, how does one "unwrap" the original error, in this contrived example the error is
bufio.ErrBufferFull
?pkg/error:
golang.org/x/xerrors:
By allowing users the option of selecting a verb to "wrap" an error will lead to unintended consequences up the call chain.
Would love to see a helper function with the signature:
(err error, format string, args ...interface{}) error
xerrors.Errorf()
is a bit too magicalThe text was updated successfully, but these errors were encountered: