ITwinError.isError Function

Determine whether an error object was thrown by iTwin.js and has a specific scope and key.

If the test succeeds, the type of error is coerced to T

isError<T extends ITwinError>(error: unknown, scope: string, key?: string): error is T

Parameter Type Description
error unknown The error to ve verified.
scope string value for error.iTwinErrorId.scope
key string value for error.iTwinErrorId.key

Returns - error is T

Defined in

Last Updated: 23 April, 2025