From bbd7a7bc2cb504933faf6119e3fc4420e5afca47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20Schw=C3=B6rer?= Date: Mon, 24 Jul 2023 11:40:47 +0200 Subject: [PATCH] v0.0.194 --- exerr/exerr.go | 13 ++++++++++++- goextVersion.go | 4 ++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/exerr/exerr.go b/exerr/exerr.go index e65055f..5064f18 100644 --- a/exerr/exerr.go +++ b/exerr/exerr.go @@ -162,7 +162,6 @@ func (ee *ExErr) RecursiveStatuscode() *int { } } - // fallback to return nil } @@ -179,6 +178,18 @@ func (ee *ExErr) RecursiveCategory() ErrorCategory { return ee.Category } +// RecursiveMeta searches (top-down) for teh first error that has a meta value with teh specified key +// and returns its value (or nil) +func (ee *ExErr) RecursiveMeta(key string) *MetaValue { + for curr := ee; curr != nil; curr = curr.OriginalError { + if metaval, ok := curr.Meta[key]; ok { + return langext.Ptr(metaval) + } + } + + return nil +} + func (ee *ExErr) Depth() int { if ee.OriginalError == nil { return 1 diff --git a/goextVersion.go b/goextVersion.go index 1681a20..09c8430 100644 --- a/goextVersion.go +++ b/goextVersion.go @@ -1,5 +1,5 @@ package goext -const GoextVersion = "0.0.193" +const GoextVersion = "0.0.194" -const GoextVersionTimestamp = "2023-07-24T11:38:57+0200" +const GoextVersionTimestamp = "2023-07-24T11:40:47+0200"