Closed pacejackson closed 3 years ago
@pacejackson please tell if you're going to update this PR based on what's discussed above.
@pacejackson no activity here since last I wrote. Presently I'm going to revisit this subject and either submit changes based on this pull request, or create a new one.
Closing this pull request in favor of https://github.com/joomcode/errorx/pull/32
~This just calls 'Error.Cause()' but allows the
Error
s to interop with the 'errors' package from the Go standard library. The main benefit is you can use 'errors.Is' to see if an Error was due to some standard error like context.Canceled.~~Add an
Is
method to*Error
. This is the helper method forerrors.Is
so you can use that to check your errors. It usesError.IsOfType
if it can (whentarget
is an*Error
), otherwise it falls back to iterating through the error chain until it reaches a non-*Error
error and callserrors.Is
against that error.~Add all of the helper methods for the "errors" package behind a build flag so they are only available for Go 1.13+.