diff --git a/exerr/constructor.go b/exerr/constructor.go index ad41488..9896abc 100644 --- a/exerr/constructor.go +++ b/exerr/constructor.go @@ -13,6 +13,25 @@ var reflectTypeStr = reflect.TypeOf("") func FromError(err error) *ExErr { + if err == nil { + // prevent NPE if we call FromError with err==nil + return &ExErr{ + UniqueID: newID(), + Category: CatForeign, + Type: TypeInternal, + Severity: SevErr, + Timestamp: time.Time{}, + StatusCode: nil, + Message: "", + WrappedErrType: "nil", + WrappedErr: err, + Caller: "", + OriginalError: nil, + Meta: make(MetaMap), + Extra: make(map[string]any), + } + } + //goland:noinspection GoTypeAssertionOnErrors if verr, ok := err.(*ExErr); ok { // A simple ExErr diff --git a/goextVersion.go b/goextVersion.go index 9887d18..f302470 100644 --- a/goextVersion.go +++ b/goextVersion.go @@ -1,5 +1,5 @@ package goext -const GoextVersion = "0.0.544" +const GoextVersion = "0.0.545" -const GoextVersionTimestamp = "2024-11-26T15:10:27+0100" +const GoextVersionTimestamp = "2024-11-27T13:21:45+0100"