predictype / predicates/errors / errorState
errorState(
source,oper):boolean
Defined in: predicates/errors/errorState.ts:26
Checks the state of an Error using the specified operation.
Error
The Error to check.
The state operation to perform (e.g. ‘has_stack’, ‘has_cause’).
boolean
True if the state check is valid according to the operator, otherwise false.
If the operation is not recognized.
const err = new Error('boom');
errorState(err, 'has_stack'); // true
errorState(new AggregateError([], 'many'), 'is_aggregate_error'); // true
Supported Operators:
causestack