This commit is contained in:
2023-07-24 11:40:47 +02:00
parent f5151eb214
commit bbd7a7bc2c
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
}
@@ -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