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 traversing the error chain. This function is useful for determining if a specific underlying error is present within a wrapped error.

Parameters

NameTypeDescription
eerrorThe error to check, which may be a wrapped error containing a cause.
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 matches e2, otherwise False.