diff --git a/exerr/errinit.go b/exerr/errinit.go index 6c85760..eadb7cc 100644 --- a/exerr/errinit.go +++ b/exerr/errinit.go @@ -19,8 +19,8 @@ type ErrorPackageConfigInit struct { ZeroLogAllTraces bool RecursiveErrors bool ExtendedGinOutput bool - ExtendGinOutput *func(err *ExErr, json map[string]any) - ExtendGinDataOutput *func(err *ExErr, depth int, json map[string]any) + ExtendGinOutput func(err *ExErr, json map[string]any) + ExtendGinDataOutput func(err *ExErr, depth int, json map[string]any) } var initialized = false @@ -42,13 +42,23 @@ func Init(cfg ErrorPackageConfigInit) { panic("Cannot re-init error package") } + ego := func(err *ExErr, json map[string]any) {} + egdo := func(err *ExErr, depth int, json map[string]any) {} + + if cfg.ExtendGinOutput != nil { + ego = cfg.ExtendGinOutput + } + if cfg.ExtendGinDataOutput != nil { + egdo = cfg.ExtendGinDataOutput + } + pkgconfig = ErrorPackageConfig{ ZeroLogErrTraces: cfg.ZeroLogErrTraces, ZeroLogAllTraces: cfg.ZeroLogAllTraces, RecursiveErrors: cfg.RecursiveErrors, ExtendedGinOutput: cfg.ExtendedGinOutput, - ExtendGinOutput: langext.Coalesce(cfg.ExtendGinOutput, func(err *ExErr, json map[string]any) {}), - ExtendGinDataOutput: langext.Coalesce(cfg.ExtendGinDataOutput, func(err *ExErr, depth int, json map[string]any) {}), + ExtendGinOutput: ego, + ExtendGinDataOutput: egdo, } initialized = true diff --git a/goextVersion.go b/goextVersion.go index 09c8430..c44752d 100644 --- a/goextVersion.go +++ b/goextVersion.go @@ -1,5 +1,5 @@ package goext -const GoextVersion = "0.0.194" +const GoextVersion = "0.0.195" -const GoextVersionTimestamp = "2023-07-24T11:40:47+0200" +const GoextVersionTimestamp = "2023-07-24T11:42:52+0200"