Where did that error happen down the call chain?
Right at the bottom!
All you need to do is, instead of:
return nil, errDo:
return nil, wrapperr.WithStack(err)Also, it is possible to annotate the stack in the middle:
And to get the original error, just used the standard errors.Unwrap(error) function from built-in errors package.