Skip to content
This repository was archived by the owner on Dec 1, 2021. It is now read-only.

fix bug: Unwrap for withStack should first try to unwrap withMessage #229

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion errors.go
Original file line number Diff line number Diff line change
@@ -160,7 +160,13 @@ type withStack struct {
func (w *withStack) Cause() error { return w.error }

// Unwrap provides compatibility for Go 1.13 error chains.
func (w *withStack) Unwrap() error { return w.error }
func (w *withStack) Unwrap() error {
if e, ok := w.error.(interface{ Unwrap() error }); ok {
return e.Unwrap()
}

return w.error
}

func (w *withStack) Format(s fmt.State, verb rune) {
switch verb {