isCanisterError
Call Signature
Section titled “Call Signature”isCanisterError<
E>(error):error is CanisterError<E>
Defined in: errors/index.ts:152
Type guard to check if an error is a CanisterError. Preserves the generic type E from the input when used in type narrowing.
Type Parameters
Section titled “Type Parameters”E
Parameters
Section titled “Parameters”CallError | CanisterError<E>
Returns
Section titled “Returns”error is CanisterError<E>
Example
Section titled “Example”// err is typed as CanisterError<TransferError> | CallErrorif (isCanisterError(err)) { // err.err is typed as TransferError (preserved!) console.log(err.err)}Call Signature
Section titled “Call Signature”isCanisterError(
error):error is CanisterError<unknown>
Defined in: errors/index.ts:155
Type guard to check if an error is a CanisterError. Preserves the generic type E from the input when used in type narrowing.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”error is CanisterError<unknown>
Example
Section titled “Example”// err is typed as CanisterError<TransferError> | CallErrorif (isCanisterError(err)) { // err.err is typed as TransferError (preserved!) console.log(err.err)}