From 0b761320cce31b58412f8723da100ab1b0a00f17 Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Wed, 29 Jul 2020 20:54:26 -0700 Subject: [PATCH] Fix error handling to be more accurate in the stacks --- loggers/cli/cli.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/loggers/cli/cli.go b/loggers/cli/cli.go index bb673b0..af71c31 100644 --- a/loggers/cli/cli.go +++ b/loggers/cli/cli.go @@ -81,7 +81,7 @@ func (h *Handler) HandleLog(e *log.Entry) error { } func getErrorStack(err error, i bool) errors.StackTrace { - e, ok := errors.Cause(err).(tracer) + e, ok := err.(tracer) if !ok { if i { // 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 getErrorStack(errors.New(err.Error()), true) + return getErrorStack(errors.Wrap(err, err.Error()), true) } st := e.StackTrace()