v0.0.510
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 4m24s
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 4m24s
This commit is contained in:
@@ -86,3 +86,28 @@ func MessageMatch(e error, matcher func(string) bool) bool {
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
// OriginalError returns the lowest level error, probably the original/external error that was originally wrapped
|
||||
func OriginalError(e error) error {
|
||||
if e == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
//goland:noinspection GoTypeAssertionOnErrors
|
||||
bmerr, ok := e.(*ExErr)
|
||||
for !ok {
|
||||
return e
|
||||
}
|
||||
|
||||
for bmerr.OriginalError != nil {
|
||||
bmerr = bmerr.OriginalError
|
||||
}
|
||||
|
||||
if bmerr.WrappedErr != nil {
|
||||
if werr, ok := bmerr.WrappedErr.(error); ok {
|
||||
return werr
|
||||
}
|
||||
}
|
||||
|
||||
return bmerr
|
||||
}
|
||||
|
Reference in New Issue
Block a user