errors icon indicating copy to clipboard operation
errors copied to clipboard

errors.IsAny does not support multi-error

Open intercept6 opened this issue 2 years ago • 0 comments

It appears that errors.IsAny does not support multi-error. https://github.com/cockroachdb/errors/blob/c1cc1919cf999fb018fcd038852e969e3d5631cc/markers/markers.go#L152-L205

errors.Is supports multi-error. https://github.com/cockroachdb/errors/blob/c1cc1919cf999fb018fcd038852e969e3d5631cc/markers/markers.go#L44-L92

Perhaps the following equivalent code can be added to IsAny.

// Recursively try multi-error causes, if applicable. 
 		for _, me := range errbase.UnwrapMulti(c) { 
 			if Is(me, reference) { 
 				return true 
 			} 
 		} 

intercept6 avatar Dec 16 '23 02:12 intercept6