v0.0.529 handle PanicWrappedErr in exerr.FromError()
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 3m13s
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 3m13s
This commit is contained in:
parent
b8cb989e54
commit
c8dec24a0d
@ -19,6 +19,52 @@ func FromError(err error) *ExErr {
|
||||
return verr
|
||||
}
|
||||
|
||||
//goland:noinspection GoTypeAssertionOnErrors
|
||||
if verr, ok := err.(langext.PanicWrappedErr); ok {
|
||||
return &ExErr{
|
||||
UniqueID: newID(),
|
||||
Category: CatForeign,
|
||||
Type: TypePanic,
|
||||
Severity: SevErr,
|
||||
Timestamp: time.Time{},
|
||||
StatusCode: nil,
|
||||
Message: "A panic occured",
|
||||
WrappedErrType: fmt.Sprintf("%T", verr),
|
||||
WrappedErr: err,
|
||||
Caller: "",
|
||||
OriginalError: nil,
|
||||
Meta: MetaMap{
|
||||
"panic_object": {DataType: MDTString, Value: fmt.Sprintf("%+v", verr)},
|
||||
"panic_type": {DataType: MDTString, Value: fmt.Sprintf("%T", verr)},
|
||||
"stack": {DataType: MDTString, Value: verr.Stack},
|
||||
},
|
||||
Extra: make(map[string]any),
|
||||
}
|
||||
}
|
||||
|
||||
//goland:noinspection GoTypeAssertionOnErrors
|
||||
if verr, ok := err.(*langext.PanicWrappedErr); ok && verr != nil {
|
||||
return &ExErr{
|
||||
UniqueID: newID(),
|
||||
Category: CatForeign,
|
||||
Type: TypePanic,
|
||||
Severity: SevErr,
|
||||
Timestamp: time.Time{},
|
||||
StatusCode: nil,
|
||||
Message: "A panic occured",
|
||||
WrappedErrType: fmt.Sprintf("%T", verr),
|
||||
WrappedErr: err,
|
||||
Caller: "",
|
||||
OriginalError: nil,
|
||||
Meta: MetaMap{
|
||||
"panic_object": {DataType: MDTString, Value: fmt.Sprintf("%+v", verr)},
|
||||
"panic_type": {DataType: MDTString, Value: fmt.Sprintf("%T", verr)},
|
||||
"stack": {DataType: MDTString, Value: verr.Stack},
|
||||
},
|
||||
Extra: make(map[string]any),
|
||||
}
|
||||
}
|
||||
|
||||
// A foreign error (eg a MongoDB exception)
|
||||
return &ExErr{
|
||||
UniqueID: newID(),
|
||||
|
@ -1,5 +1,5 @@
|
||||
package goext
|
||||
|
||||
const GoextVersion = "0.0.528"
|
||||
const GoextVersion = "0.0.529"
|
||||
|
||||
const GoextVersionTimestamp = "2024-10-07T17:20:40+0200"
|
||||
const GoextVersionTimestamp = "2024-10-08T19:22:17+0200"
|
||||
|
Loading…
Reference in New Issue
Block a user