BRIKEV/openapi-validator-utils

View on GitHub
utils/configError.js

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
const errors = require('./errorMethod');

/** @module Utils/configError */

/**
 * Description of the function
 * @name ErrorHandler
 * @function
 * @param {string} message Error message
 * @param {object} extra Ajv or extra error info
 */

/**
 * @param {BuilderResponse} error
 * @param {ErrorHandler} handler function to extend default behavior
 */
const configError = (error, handler) => {
  if (!error.valid) {
    throw errors.configuration(error.errorMessage, handler);
  }
};

module.exports = configError;