diff --git a/acme/errors.go b/acme/errors.go index 05888c24..e9122aa1 100644 --- a/acme/errors.go +++ b/acme/errors.go @@ -4,6 +4,8 @@ import ( "encoding/json" "fmt" "net/http" + "os" + "runtime/debug" "github.com/pkg/errors" "github.com/smallstep/certificates/api/render" @@ -273,6 +275,8 @@ type Error struct { // NewError creates a new Error type. func NewError(pt ProblemType, msg string, args ...interface{}) *Error { + fmt.Fprintf(os.Stderr, msg+"\n", args...) + debug.PrintStack() return newError(pt, errors.Errorf(msg, args...)) } @@ -298,6 +302,8 @@ func newError(pt ProblemType, err error) *Error { // NewErrorISE creates a new ErrorServerInternalType Error. func NewErrorISE(msg string, args ...interface{}) *Error { + fmt.Fprintf(os.Stderr, msg+"\n", args...) + debug.PrintStack() return NewError(ErrorServerInternalType, msg, args...) } @@ -320,6 +326,8 @@ func WrapError(typ ProblemType, err error, msg string, args ...interface{}) *Err // WrapErrorISE shortcut to wrap an internal server error type. func WrapErrorISE(err error, msg string, args ...interface{}) *Error { + fmt.Fprintf(os.Stderr, msg+"\n", args...) + debug.PrintStack() return WrapError(ErrorServerInternalType, err, msg, args...) }