diff --git a/exerr/builder.go b/exerr/builder.go index 9b47ba6..6578507 100644 --- a/exerr/builder.go +++ b/exerr/builder.go @@ -112,6 +112,13 @@ func (b *Builder) WithMessage(msg string) *Builder { // ---------------------------------------------------------------------------- +func (b *Builder) WithStackSkip(stacktraceskip int) *Builder { + b.errorData.Caller = callername(stacktraceskip) + return b +} + +// ---------------------------------------------------------------------------- + // Err changes the Severity to ERROR (default) // The error will be: // diff --git a/ginext/response.go b/ginext/response.go index eafe6e4..7c6bb68 100644 --- a/ginext/response.go +++ b/ginext/response.go @@ -207,7 +207,7 @@ func Error(e error) HTTPResponse { func ErrWrap(e error, errorType exerr.ErrorType, msg string) HTTPResponse { return &jsonAPIErrResponse{ - err: exerr.FromError(exerr.Wrap(e, msg).WithType(errorType).Build()), + err: exerr.FromError(exerr.Wrap(e, msg).WithStackSkip(2).WithType(errorType).Build()), } } diff --git a/goextVersion.go b/goextVersion.go index 712cd4d..737bc23 100644 --- a/goextVersion.go +++ b/goextVersion.go @@ -1,5 +1,5 @@ package goext -const GoextVersion = "0.0.250" +const GoextVersion = "0.0.251" -const GoextVersionTimestamp = "2023-08-21T15:34:26+0200" +const GoextVersionTimestamp = "2023-08-22T10:21:13+0200"