This commit is contained in:
Mike Schwörer 2023-07-24 11:40:47 +02:00
parent f5151eb214
commit bbd7a7bc2c
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
2 changed files with 14 additions and 3 deletions

View File

@ -162,7 +162,6 @@ func (ee *ExErr) RecursiveStatuscode() *int {
} }
} }
// fallback to <empty>
return nil return nil
} }
@ -179,6 +178,18 @@ func (ee *ExErr) RecursiveCategory() ErrorCategory {
return ee.Category 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 { func (ee *ExErr) Depth() int {
if ee.OriginalError == nil { if ee.OriginalError == nil {
return 1 return 1

View File

@ -1,5 +1,5 @@
package goext 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"