Skip to content
Myr

fix(errors): change Unwrap method receiver to value type (#4232)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Orkhan Alikhanov · committed by GitHub · parent cf32d2d · Browse files · 2 files+12 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+12 added−1 removed

  • other:+12 added−1 removed

2 files+12 added−1 removed

modified:errors_test.go+11 added
124 unmodified lines
125 // check that 'errors.Is()' and 'errors.As()' behave as expected :126 require.ErrorIs(t, err, innerErr)127 var testErr TestErr128 require.ErrorAs(t, err, &testErr)129130 // Test non-pointer usage of gin.Error131 errNonPointer := Error{132 Err: innerErr,133 Type: ErrorTypeAny,134 }135 wrappedErr := fmt.Errorf("wrapped: %w", errNonPointer)136 // Check that 'errors.Is()' and 'errors.As()' behave as expected for non-pointer usage137 require.ErrorIs(t, wrappedErr, innerErr)138 var testErrNonPointer TestErr139 require.ErrorAs(t, wrappedErr, &testErrNonPointer)140}
modified:errors.go+1 added-1 removed
89 unmodified lines
90 return (msg.Type & flags) > 091}9293// Unwrap returns the wrapped error, to allow interoperability with errors.Is(), errors.As() and errors.Unwrap()94func (msg *Error) Unwrap() error {94func (msg Error) Unwrap() error {95 return msg.Err96}9798// ByType returns a readonly copy filtered the byte.
77 unmodified lines