Replace error handling package with emperror; add better reporting for errors escaping server root

This commit is contained in:
Dane Everitt
2020-11-08 13:52:20 -08:00
parent 0989c78d4b
commit be9d1a3986
55 changed files with 396 additions and 367 deletions

View File

@@ -6,7 +6,7 @@ import (
"github.com/apex/log/handlers/cli"
color2 "github.com/fatih/color"
"github.com/mattn/go-colorable"
"github.com/pkg/errors"
"emperror.dev/errors"
"io"
"os"
"sync"
@@ -88,10 +88,10 @@ func getErrorStack(err error, i bool) errors.StackTrace {
if i {
// Just abort out of this and return a stacktrace leading up to this point. It isn't perfect
// but it'll at least include what function lead to this being called which we can then handle.
return errors.Wrap(err, "failed to generate stacktrace for caught error").(tracer).StackTrace()
return errors.WrapIf(err, "failed to generate stacktrace for caught error").(tracer).StackTrace()
}
return getErrorStack(errors.Wrap(err, err.Error()), true)
return getErrorStack(errors.WrapIf(err, err.Error()), true)
}
st := e.StackTrace()
@@ -101,7 +101,7 @@ func getErrorStack(err error, i bool) errors.StackTrace {
// trace since they'll point to the error that was generated by this function.
f := 0
if i {
f = 4
f = 5
}
if i && l > 9 {