Back to Mocha

Error Codes

docs-next/src/content/docs/features/error-codes.mdx

11.7.61.2 KB
Original Source

:::note[New in v6.0.0] :::

When Mocha itself throws exception, the associated Error will have a code property. Where applicable, consumers should check the code property instead of string-matching against the message property. The following table describes these error codes:

CodeDescription
ERR_MOCHA_INVALID_ARG_TYPEwrong type was passed for a given argument
ERR_MOCHA_INVALID_ARG_VALUEinvalid or unsupported value was passed for a given argument
ERR_MOCHA_INVALID_EXCEPTIONa falsy or otherwise underspecified exception was thrown
ERR_MOCHA_INVALID_INTERFACEinterface specified in options not found
ERR_MOCHA_INVALID_REPORTERreporter specified in options not found
ERR_MOCHA_NO_FILES_MATCH_PATTERNtest file(s) could not be found
ERR_MOCHA_UNSUPPORTEDrequested behavior, option, or parameter is unsupported