v0.0.370 improve sq errors
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m36s
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m36s
This commit is contained in:
@@ -13,6 +13,7 @@ type ErrorPackageConfig struct {
|
||||
IncludeMetaInGinOutput bool // Log meta fields ( from e.g. `.Str(key, val).Build()` ) to gin in err.Output()
|
||||
ExtendGinOutput func(err *ExErr, json map[string]any) // (Optionally) extend the gin output with more fields
|
||||
ExtendGinDataOutput func(err *ExErr, depth int, json map[string]any) // (Optionally) extend the gin `__data` output with more fields
|
||||
DisableErrorWrapping bool // Disables the exerr.Wrap()...Build() function - will always return the original error
|
||||
}
|
||||
|
||||
type ErrorPackageConfigInit struct {
|
||||
@@ -23,6 +24,7 @@ type ErrorPackageConfigInit struct {
|
||||
IncludeMetaInGinOutput *bool
|
||||
ExtendGinOutput func(err *ExErr, json map[string]any)
|
||||
ExtendGinDataOutput func(err *ExErr, depth int, json map[string]any)
|
||||
DisableErrorWrapping *bool
|
||||
}
|
||||
|
||||
var initialized = false
|
||||
@@ -35,6 +37,7 @@ var pkgconfig = ErrorPackageConfig{
|
||||
IncludeMetaInGinOutput: true,
|
||||
ExtendGinOutput: func(err *ExErr, json map[string]any) {},
|
||||
ExtendGinDataOutput: func(err *ExErr, depth int, json map[string]any) {},
|
||||
DisableErrorWrapping: false,
|
||||
}
|
||||
|
||||
// Init initializes the exerr packages
|
||||
@@ -63,6 +66,7 @@ func Init(cfg ErrorPackageConfigInit) {
|
||||
IncludeMetaInGinOutput: langext.Coalesce(cfg.IncludeMetaInGinOutput, pkgconfig.IncludeMetaInGinOutput),
|
||||
ExtendGinOutput: ego,
|
||||
ExtendGinDataOutput: egdo,
|
||||
DisableErrorWrapping: langext.Coalesce(cfg.DisableErrorWrapping, pkgconfig.DisableErrorWrapping),
|
||||
}
|
||||
|
||||
initialized = true
|
||||
|
Reference in New Issue
Block a user