utility/aliased/aliased_protocol.js
function () {
  /**
   * Renders an error view from a template and sends data to client
   * @param  {Object}   opts Configurable options (see periodicjs.core.responder for more details)
   * @param {string|Object} opts.err Error details for response
   * @param {Object} opts.req Express request object
   * @param {Object} opts.res Express response object
   * @param  {Function} [callback]   Optional callback function
   * @return {Object}      If callback is not defined returns a Promise which resolves after response has been sent
   */
  let fn = function handleDocumentQueryErrorResponse (opts = {}, callback) {
    let { err, req, res } = opts;
    if (opts.use_warning) this.protocol.warn(req, res, { err });
    else this.protocol.error(req, res, { err });
    if (req.query.format === 'json' || req.params.ext === 'json' || path.extname(req.originalUrl) === '.json' || req.is('json') || req.params.callback || req.is('application/json')) {
      return this.protocol.respond(req, res, { err });
    }
    else if (typeof callback === 'function') {
      return this.responder.error(err)
        .then(result => callback(null, result))
        .catch(callback);
    }
    else if (req.redirecturl) {
      req.redirectpath = (!req.redirectpath && req.redirecturl) ? req.redirecturl : req.redirectpath;
      return this.protocol.redirect(req, res);
    }
    else {
      return this._utility_responder.error(err, {})
        .then(result => {
          return this.protocol.respond(req, res, { responder_override: result });
        }, err => {
          return this.protocol.exception(req, res, { err });
        });
    }
  };
  let message = 'CoreController.handleDocumentQueryErrorResponse: Use CoreController.responder.error with an HTML adapter or CoreController._utility_responder.error instead';
  return wrapWithDeprecationWarning.call(this, fn, message);
}
function () {
  /**
   * Renders an error view from a template and sends data to client
   * @param  {Object}   opts Configurable options (see periodicjs.core.responder for more details)
   * @param {string|Object} opts.err Error details for response
   * @param {Object} opts.req Express request object
   * @param {Object} opts.res Express response object
   * @param  {Function} [callback]   Optional callback function
   * @return {Object}      If callback is not defined returns a Promise which resolves after response has been sent
   */
  let fn = function handleDocumentQueryErrorResponse (opts = {}, callback) {
    let { err, req, res } = opts;
    if (opts.use_warning) this.protocol.warn(req, res, { err });
    else this.protocol.error(req, res, { err });
    if (req.query.format === 'json' || req.params.ext === 'json' || path.extname(req.originalUrl) === '.json' || req.is('json') || req.params.callback || req.is('application/json')) {
      return this.protocol.respond(req, res, { err });
    }
    else if (typeof callback === 'function') {
      return this.responder.error(err)
        .then(result => callback(null, result))
        .catch(callback);
    }
    else if (req.redirecturl) {
      req.redirectpath = (!req.redirectpath && req.redirecturl) ? req.redirecturl : req.redirectpath;
      return this.protocol.redirect(req, res);
    }
    else {
      return this._utility_responder.error(err, {})
        .then(result => {
          return this.protocol.respond(req, res, { responder_override: result });
        }, err => {
          return this.protocol.exception(req, res, { err });
        });
    }
  };
  let message = 'CoreController.handleDocumentQueryErrorResponse: Use CoreController.responder.error with an HTML adapter or CoreController._utility_responder.error instead';
  return wrapWithDeprecationWarning.call(this, fn, message);
}
function ( ) { /**
   * Renders an error view from a template and sends data to client
   * @param  {Object}   opts Configurable options (see periodicjs.core.responder for more details)
   * @param {string|Object} opts.err Error details for response
   * @param {Object} opts.req Express request object
   * @param {Object} opts.res Express response object
   * @param  {Function} [callback]   Optional callback function
   * @return {Object}      If callback is not defined returns a Promise which resolves after response has been sent
   */ let fn = function handleDocumentQueryErrorResponse ( opts = { } , callback ) { let { err , req , res } = opts ; if ( opts . use_warning ) this . protocol . warn ( req , res , { err } ) ; else this . protocol . error ( req , res , { err } ) ; if ( req . query . format === 'json' || req . params . ext === 'json' || path . extname ( req . originalUrl ) === '.json' || req . is ( 'json' ) || req . params . callback || req . is ( 'application/json' ) ) { return this . protocol . respond ( req , res , { err } ) ; } else if ( typeof callback === 'function' ) { return this . responder . error ( err ) . then ( result => callback ( null , result ) ) . catch ( callback ) ; } else if ( req . redirecturl ) { req . redirectpath = ( ! req . redirectpath && req . redirecturl ) ? req . redirecturl : req . redirectpath ; return this . protocol . redirect ( req , res ) ; } else { return this . _utility_responder . error ( err , { } ) . then ( result => { return this . protocol . respond ( req , res , { responder_override : result } ) ; } , err => { return this . protocol . exception ( req , res , { err } ) ; } ) ; } } ; let message = 'CoreController.handleDocumentQueryErrorResponse: Use CoreController.responder.error with an HTML adapter or CoreController._utility_responder.error instead' ; return wrapWithDeprecationWarning . call ( this , fn , message ) ; }
Creates a function that will render an error view from a template. Alias for CoreController._utility_responder.error
@return {Function} A function that will render an error view from a template and send response
Creates a function that will render an error view from a template . Alias for CoreController . _utility_responder . error