lib/index.js
function handleErrorRequest(result, req, res) {
    const err = _.isError(result.msg) ? result.msg : result;
    const finalResp = STATUSES[result.status] || STATUSES[err.message] || STATUSES['error'];
    finalResp.msg = err.message;
    if (isDebug) finalResp.ext = err;

    logRequestError(err, req, finalResp);

    res.status(finalResp.statusCode);
    const view = result.view || errorView;
    if (view) {
      returnHTML(view, finalResp, res);
    } else {
      returnJSON(finalResp, res);
    }
  }
function handleErrorRequest(result, req, res) {
    const err = _.isError(result.msg) ? result.msg : result;
    const finalResp = STATUSES[result.status] || STATUSES[err.message] || STATUSES['error'];
    finalResp.msg = err.message;
    if (isDebug) finalResp.ext = err;

    logRequestError(err, req, finalResp);

    res.status(finalResp.statusCode);
    const view = result.view || errorView;
    if (view) {
      returnHTML(view, finalResp, res);
    } else {
      returnJSON(finalResp, res);
    }
  }
function handleErrorRequest ( result , req , res ) { const err = _ . isError ( result . msg ) ? result . msg : result ; const finalResp = STATUSES [ result . status ] || STATUSES [ err . message ] || STATUSES [ 'error' ] ; finalResp . msg = err . message ; if ( isDebug ) finalResp . ext = err ; logRequestError ( err , req , finalResp ) ; res . status ( finalResp . statusCode ) ; const view = result . view || errorView ; if ( view ) { returnHTML ( view , finalResp , res ) ; } else { returnJSON ( finalResp , res ) ; } }
handle result according to its type
handle result according to its type