We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
nil check when wrapping errors fails for custom error types. nil error get wrapped and - with pointers - it even results in a panic.
panic
Here's a UT that demonstrates the behavior:
package go_err import ( "testing" "github.com/go-errors/errors" ) type MyError1 struct { message string } func (me1 MyError1) Error() string{ return me1.message } type MyError2 struct { message string } func (me2 *MyError2) Error() string{ return me2.message } func TestNilErr(t *testing.T) { var ( err error myErr1 MyError1 myErr2 *MyError2 ) err = errors.WrapPrefix(err, "blah message", 0) t.Log("base error", "value", err) // Shouldn't be wrapped, but it is err = errors.WrapPrefix(myErr1, "blah message", 0) t.Log("my error 1", "value", err) // Shouldn't be wrapped, but it panics err = errors.WrapPrefix(myErr2, "blah message", 0) t.Log("my error 2", "value", err) }
The text was updated successfully, but these errors were encountered:
Sent pull request #36 that should fix the issue
Sorry, something went wrong.
No branches or pull requests
nil check when wrapping errors fails for custom error types. nil error get wrapped and - with pointers - it even results in a
panic
.Here's a UT that demonstrates the behavior:
The text was updated successfully, but these errors were encountered: