Function: isScpError()
ts
function isScpError(value, code?): value is ScpError;Whether value is a ScpError, optionally with a specific code. Narrows the type in TypeScript.
Parameters
| Parameter | Type |
|---|---|
value | unknown |
code? | ErrorCode |
Returns
value is ScpError
Example
ts
if (isScpError(err, ErrorCode.NotFound)) console.log(`missing: ${err.path}`);