predictype / predicates/errors / errorMessage
errorMessage(
source,oper,target):boolean
Defined in: predicates/errors/errorMessage.ts:27
Checks the message of an Error using the specified operation.
Error
The Error to check.
The message operation to perform (e.g. ‘equals’, ‘includes’).
string
The string to compare the error message against.
boolean
True if the message check is valid according to the operator, otherwise false.
If the operation is not recognized.
const err = new Error('Network timeout');
errorMessage(err, 'includes', 'timeout'); // true
errorMessage(err, 'starts_with', 'Network'); // true
Supported Operators: