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:
parent
2a0471fb3d
commit
9264a2e99b
@ -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 {
|
||||
|
@ -1,5 +1,5 @@
|
||||
package goext
|
||||
|
||||
const GoextVersion = "0.0.355"
|
||||
const GoextVersion = "0.0.356"
|
||||
|
||||
const GoextVersionTimestamp = "2024-01-05T10:25:05+0100"
|
||||
const GoextVersionTimestamp = "2024-01-05T10:43:39+0100"
|
||||
|
Loading…
Reference in New Issue
Block a user