Fix error handling to be more accurate in the stacks

This commit is contained in:
Dane Everitt 2020-07-29 20:54:26 -07:00
parent db0dc17937
commit 0b761320cc
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53

View File

@ -81,7 +81,7 @@ func (h *Handler) HandleLog(e *log.Entry) error {
} }
func getErrorStack(err error, i bool) errors.StackTrace { func getErrorStack(err error, i bool) errors.StackTrace {
e, ok := errors.Cause(err).(tracer) e, ok := err.(tracer)
if !ok { if !ok {
if i { if i {
// Just abort out of this and return a stacktrace leading up to this point. It isn't perfect // Just abort out of this and return a stacktrace leading up to this point. It isn't perfect
@ -89,7 +89,7 @@ func getErrorStack(err error, i bool) errors.StackTrace {
return errors.Wrap(err, "failed to generate stacktrace for caught error").(tracer).StackTrace() return errors.Wrap(err, "failed to generate stacktrace for caught error").(tracer).StackTrace()
} }
return getErrorStack(errors.New(err.Error()), true) return getErrorStack(errors.Wrap(err, err.Error()), true)
} }
st := e.StackTrace() st := e.StackTrace()