You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since extractError() only looks at the root cause and discards other errors in the error stack (https://github.com/heroku/rollrus/blob/master/rollrus.go#L270-L275), if there are multiple wrapped errors and the root cause does not have a stacktrace, it will discard the stacktraces from the other errors. I propose that it uses the deepest stack it can find:
func getDeepestStackTrace(err error) errors.StackTrace {
type errorCauser interface {
Cause() error
}
type stackTracer interface {
StackTrace() errors.StackTrace
}
var deepestStackTrace errors.StackTrace
for {
if tracer, ok := err.(stackTracer); ok {
deepestStackTrace = tracer.StackTrace()
}
if causer, ok := err.(errorCauser); ok {
err = causer.Cause()
} else {
break
}
}
return deepestStackTrace
}
The text was updated successfully, but these errors were encountered:
cyrusaf
changed the title
extractError will discard stack if root cause doesn't have a stack trace attached
extractError() will discard stack if root cause doesn't have a stack trace attached
Nov 27, 2018
Since
extractError()
only looks at the root cause and discards other errors in the error stack (https://github.com/heroku/rollrus/blob/master/rollrus.go#L270-L275), if there are multiple wrapped errors and the root cause does not have a stacktrace, it will discard the stacktraces from the other errors. I propose that it uses the deepest stack it can find:The text was updated successfully, but these errors were encountered: