constructor
The constructor creates an Error from its serialized Worker envelope.
new ClientError(error: SerializedError): ClientError| Type | Description | |
|---|---|---|
error | SerializedError | |
| returns | ClientError |
Example
import {ClientError} from 'tinyjoin';
const error = new ClientError({
code: 'INVALID_ARGUMENT',
message: 'A task needs a title.',
details: {column: 'title'},
});
console.log(error instanceof Error);
// -> true
console.log(error.code, error.details, error.retryable);
// -> 'INVALID_ARGUMENT' {column: 'title'} false