v0.0.356 exerr.GetMeta
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m9s
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 1m9s
This commit is contained in:
@@ -258,6 +258,18 @@ func (ee *ExErr) Depth() int {
|
||||
}
|
||||
}
|
||||
|
||||
// GetMeta returns the meta value with the specified key
|
||||
// this method recurses through all wrapped errors and returns the first matching meta value
|
||||
func (ee *ExErr) GetMeta(key string) (any, bool) {
|
||||
for curr := ee; curr != nil; curr = curr.OriginalError {
|
||||
if v, ok := curr.Meta[key]; ok {
|
||||
return v.Value, true
|
||||
}
|
||||
}
|
||||
|
||||
return nil, false
|
||||
}
|
||||
|
||||
// contains test if the supplied error is contained in this error (anywhere in the chain)
|
||||
func (ee *ExErr) contains(original *ExErr) (*ExErr, bool) {
|
||||
if original == nil {
|
||||
|
Reference in New Issue
Block a user