Add Messenger/Contexter interface to work Message (and Trace) with errors.As
Changes
- Add Messenger/Contexer interface to work with errors.As.
- Use pointer internally for Tracer.
- Drop support Go 1.11 and 1.12 because they don't have errors.As method.
Motivation
To be compatible with the standard errors way.
failure.MessageOf and failure.Trace could panic when an error in the error chain calls errors.As in As(interface{}) bool function to delegate to internal errors.
⚠️ Breaking Change ⚠️
If you implements As(interface{}) bool in your error and using type switch with case failure.Tracer, then you should change it to case *failure.Tracer (use pointer).
Codecov Report
Base: 92.87% // Head: 91.42% // Decreases project coverage by -1.45% :warning:
Coverage data is based on head (
a80342d) compared to base (bee906e). Patch coverage: 100.00% of modified lines in pull request are covered.
Additional details and impacted files
@@ Coverage Diff @@
## main #45 +/- ##
==========================================
- Coverage 92.87% 91.42% -1.46%
==========================================
Files 6 6
Lines 365 373 +8
==========================================
+ Hits 339 341 +2
- Misses 20 26 +6
Partials 6 6
| Impacted Files | Coverage Δ | |
|---|---|---|
| failure.go | 96.66% <100.00%> (ø) |
|
| tracer.go | 96.29% <100.00%> (ø) |
|
| wrapper.go | 90.36% <100.00%> (-3.31%) |
:arrow_down: |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.