lib/buildHandler.js
function buildHandler(overrides) {
  const parseError = buildHandler.parseError;
  const buildError = buildHandler.buildError;

  /**
   * .
   */
  return function handler(error) {
    const found = parseError.apply(this, arguments);
    if (!found) {
      if (error instanceof Error) {
        Error.captureStackTrace(error, handler);
        throw error;
      }
      return sliced(arguments);
    }
    error = buildError.apply(this, found);
    if (notEmptyObject(overrides)) {
      Object.assign(error, overrides);
    }
    Error.captureStackTrace(error, handler);
    throw error;
  };
}
function buildHandler(overrides) {
  const parseError = buildHandler.parseError;
  const buildError = buildHandler.buildError;

  /**
   * .
   */
  return function handler(error) {
    const found = parseError.apply(this, arguments);
    if (!found) {
      if (error instanceof Error) {
        Error.captureStackTrace(error, handler);
        throw error;
      }
      return sliced(arguments);
    }
    error = buildError.apply(this, found);
    if (notEmptyObject(overrides)) {
      Object.assign(error, overrides);
    }
    Error.captureStackTrace(error, handler);
    throw error;
  };
}
function buildHandler ( overrides ) { const parseError = buildHandler . parseError ; const buildError = buildHandler . buildError ; /**
   * .
   */ return function handler ( error ) { const found = parseError . apply ( this , arguments ) ; if ( ! found ) { if ( error instanceof Error ) { Error . captureStackTrace ( error , handler ) ; throw error ; } return sliced ( arguments ) ; } error = buildError . apply ( this , found ) ; if ( notEmptyObject ( overrides ) ) { Object . assign ( error , overrides ) ; } Error . captureStackTrace ( error , handler ) ; throw error ; } ; }
Build a handler.

@param {Object} overrides override the error attributes
@return {Function} the handler
Build a handler .