Skip to main content

isXtlError()

function isXtlError(e): e is XtlError;

Defined in: src/error-codes.ts:124

Type guard for XtlError. Returns true only for Error instances whose code starts with xl3/. Plain Errors, host-supplied error shapes, and non-Error values all return false.

Parameters

ParameterType
eunknown

Returns

e is XtlError

Stable

Frozen at 1.0.

Example

try {
await convert(templateBuffer, sourceBuffer);
} catch (e) {
// dispatch on the stable code, not the English message
if (isXtlError(e)) console.error(e.code); // e.g. 'xl3/filename/collision'
}