diff --git a/exerr/constructor.go b/exerr/constructor.go index e2b1f3a..aef3d75 100644 --- a/exerr/constructor.go +++ b/exerr/constructor.go @@ -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(), diff --git a/goextVersion.go b/goextVersion.go index 494122c..c514de5 100644 --- a/goextVersion.go +++ b/goextVersion.go @@ -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"