Skip to main content

IsCausedByError

No overview available.

def IsCausedByError(
e: error,
e2: error
) - > bool

Checks if an error e is caused by another error e2 by recursively unwrapping the error chain. This function is useful for determining if a specific underlying error is present within a complex error structure.

Parameters

NameTypeDescription
eerrorThe error to inspect, which may be part of an error chain.
e2errorThe specific error to look for within the error chain of e.

Returns

TypeDescription
boolTrue if e or any of its causes in the error chain is e2, otherwise False.