From b520282ba088278025332599f6f0a8800acda168 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Wed, 27 Nov 2024 13:21:45 +0100 Subject: [PATCH] v0.0.545 --- exerr/constructor.go | 19 +++++++++++++++++++ goextVersion.go | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) 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"