@contract-case/case-plugin-base
Version:
Plugin framework for writing plugins for the ContractCase test framework
42 lines • 1.66 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CaseConfigurationError = void 0;
const renderer_1 = require("./renderer");
const ErrorCodes_1 = require("./ErrorCodes");
/**
* Indicates that the user has configured ContractCase incorrectly.
*
* Throw this during mock setup if you encounter configuration errors.
*
* @public
*/
class CaseConfigurationError extends Error {
/**
* The error code to help the user debug this
*/
contractCaseErrorCode;
/**
* If there's a user facing stack trace, this will be set to a non-empty string.
*
* The stack trace will have multiple lines separated by '\\n'
*/
userFacingStackTrace;
/**
* Constructs a CaseConfigurationError.
*
* @param message - the message for this error
* @param context - the match context, used to add '(at $location)' to the
* message. You can also pass 'DONT_ADD_LOCATION' if you don't want to append
* this to the message.
* @param code - an optional ConfigurationErrorCode to aid the user in debugging.
*/
constructor(message, context, code = ErrorCodes_1.ErrorCodes.configuration.UNDOCUMENTED, userFacingStackTrace = '') {
super(`${message}${context !== 'DONT_ADD_LOCATION' ? (0, renderer_1.errorLocationString)(context) : ''}`);
Object.setPrototypeOf(this, new.target.prototype);
this.name = 'CaseConfigurationError';
this.contractCaseErrorCode = code;
this.userFacingStackTrace = userFacingStackTrace;
}
}
exports.CaseConfigurationError = CaseConfigurationError;
//# sourceMappingURL=CaseConfigurationError.js.map