Skip to content

Commit

Permalink
update withStackInfo.Stack with WithData() - specially for defer reco…
Browse files Browse the repository at this point in the history
…ver codes
  • Loading branch information
hedzr committed Mar 24, 2022
1 parent b147716 commit b0a763e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions withstackinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,12 @@ func (w *WithStackInfo) WithCode(code Code) Buildable {
//
func (w *WithStackInfo) WithErrors(errs ...error) Buildable {
_ = w.causes2.WithErrors(errs...)

//for _, e := range errs {
// if e1, ok := e.(*WithStackInfo); ok {
// w.Stack = e1.Stack
// }
//}
return w
}

Expand All @@ -135,6 +141,9 @@ func (w *WithStackInfo) WithData(errs ...interface{}) Buildable {
for _, e := range errs {
if e1, ok := e.(error); ok {
_ = w.WithErrors(e1)
if e1, ok := e.(*WithStackInfo); ok {
w.Stack = e1.Stack
}
} else if e != nil {
w.sites = append(w.sites, e)
}
Expand Down

0 comments on commit b0a763e

Please sign in to comment.