js/modules/router.js
function htmlCloseError(options) {
    options = options || {};
    options.debugLocalNetwork = options.debugLocalNetwork == null ? true : options.debugLocalNetwork;
    return function (err, req, res, next) {
        var msg = err.message || err.code;
        res.statusCode = err.status || err.statusCode || 500;
        res.statusMessage = msg;
        res.setHeader('Content-Type', 'text/html');
        if (msg)
            res.setHeader('message', cleanStatusMessage(msg));
        var output = '<h3>' + msg + '</h3>'; //message meat
        var isDebug = options.debug || (options.debugLocalNetwork && ack.reqres(req, res).req.isLocalNetwork());
        var dump = null;
        if (isDebug) {
            dump = { Error: err };
            var jErr = ack.error(err);
            if (err.stack) {
                output += jErr.getFirstTrace();
                dump.stack = jErr.getStackArray();
            }
        }
        else {
            dump = err;
        }
        output += ack(dump).dump('html');
        res.end(output);
    };
}
function htmlCloseError(options) {
    options = options || {};
    options.debugLocalNetwork = options.debugLocalNetwork == null ? true : options.debugLocalNetwork;
    return function (err, req, res, next) {
        var msg = err.message || err.code;
        res.statusCode = err.status || err.statusCode || 500;
        res.statusMessage = msg;
        res.setHeader('Content-Type', 'text/html');
        if (msg)
            res.setHeader('message', cleanStatusMessage(msg));
        var output = '<h3>' + msg + '</h3>'; //message meat
        var isDebug = options.debug || (options.debugLocalNetwork && ack.reqres(req, res).req.isLocalNetwork());
        var dump = null;
        if (isDebug) {
            dump = { Error: err };
            var jErr = ack.error(err);
            if (err.stack) {
                output += jErr.getFirstTrace();
                dump.stack = jErr.getStackArray();
            }
        }
        else {
            dump = err;
        }
        output += ack(dump).dump('html');
        res.end(output);
    };
}
function htmlCloseError ( options ) { options = options || { } ; options . debugLocalNetwork = options . debugLocalNetwork == null ? true : options . debugLocalNetwork ; return function ( err , req , res , next ) { var msg = err . message || err . code ; res . statusCode = err . status || err . statusCode || 500 ; res . statusMessage = msg ; res . setHeader ( 'Content-Type' , 'text/html' ) ; if ( msg ) res . setHeader ( 'message' , cleanStatusMessage ( msg ) ) ; var output = '<h3>' + msg + '</h3>' ; //message meat var isDebug = options . debug || ( options . debugLocalNetwork && ack . reqres ( req , res ) . req . isLocalNetwork ( ) ) ; var dump = null ; if ( isDebug ) { dump = { Error : err } ; var jErr = ack . error ( err ) ; if ( err . stack ) { output += jErr . getFirstTrace ( ) ; dump . stack = jErr . getStackArray ( ) ; } } else { dump = err ; } output += ack ( dump ) . dump ( 'html' ) ; res . end ( output ) ; } ; }
Returns universal error handler middleware
@options {debug:true/false, debugLocalNetwork:true}
Returns universal error handler middleware