sdk-javascript/lib/validation_error.js

18 lines
542 B
JavaScript

/**
* A Error class that will be thrown when a CloudEvent
* cannot be properly validated against a the specification.
*/
class ValidationError extends TypeError {
/**
* Constructs a new {ValidationError} with the message
* and array of additional errors.
* @param {string} message the error message
* @param {[string]|[ErrorObject]} [errors] any additional errors related to validation
*/
constructor(message, errors) {
super(message);
this.errors = errors ? errors : [];
}
}
module.exports = ValidationError;