v0.0.370 improve sq errors
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m36s

This commit is contained in:
2024-01-13 14:10:25 +01:00
parent aae8a706e9
commit be24f7a190
4 changed files with 18 additions and 8 deletions

View File

@@ -68,6 +68,7 @@ func init() {
}
type Builder struct {
wrappedErr error
errorData *ExErr
containsGinData bool
noLog bool
@@ -89,9 +90,9 @@ func Wrap(err error, msg string) *Builder {
if !pkgconfig.RecursiveErrors {
v := FromError(err)
v.Message = msg
return &Builder{errorData: v}
return &Builder{wrappedErr: err, errorData: v}
}
return &Builder{errorData: wrapExErr(FromError(err), msg, CatWrap, 1)}
return &Builder{wrappedErr: err, errorData: wrapExErr(FromError(err), msg, CatWrap, 1)}
}
// ----------------------------------------------------------------------------
@@ -414,6 +415,10 @@ func extractHeader(header map[string][]string) []string {
func (b *Builder) Build() error {
warnOnPkgConfigNotInitialized()
if pkgconfig.DisableErrorWrapping && b.wrappedErr != nil {
return b.wrappedErr
}
if pkgconfig.ZeroLogErrTraces && !b.noLog && (b.errorData.Severity == SevErr || b.errorData.Severity == SevFatal) {
b.errorData.ShortLog(stackSkipLogger.Error())
} else if pkgconfig.ZeroLogAllTraces && !b.noLog {