Skip to content

Commit

Permalink
fix: copy global root errors to ensure stack traces are isolated (#58,
Browse files Browse the repository at this point in the history
  • Loading branch information
morningvera authored Jan 11, 2020
1 parent ebc3771 commit c742c91
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion eris.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@ func wrap(err error, msg string) error {
switch e := err.(type) {
case *rootError:
if e.global {
e.stack = stack
// create a new root error for global values to make sure nothing interferes with the stack
err = &rootError{
global: e.global,
msg: e.msg,
stack: stack,
}
}
case *wrapError:
default:
Expand Down

0 comments on commit c742c91

Please sign in to comment.