src/lib/errors.js
function getErrorNameFromStatusCode(statusCode) {
    statusCode = parseInt(statusCode, 10);
    var status = http.STATUS_CODES[statusCode];
    if (!status) { return false; }

    var name = '';
    var words = status.split(/\s+/);
    words.forEach(function(w) {
        name += w.charAt(0).toUpperCase() + w.slice(1).toLowerCase();
    });

    name = name.replace(/\W+/g, '');

    if (!/\w+Error$/.test(name)) {
        name += 'Error';
    }
    return name;
}
function getErrorNameFromStatusCode(statusCode) {
    statusCode = parseInt(statusCode, 10);
    var status = http.STATUS_CODES[statusCode];
    if (!status) { return false; }

    var name = '';
    var words = status.split(/\s+/);
    words.forEach(function(w) {
        name += w.charAt(0).toUpperCase() + w.slice(1).toLowerCase();
    });

    name = name.replace(/\W+/g, '');

    if (!/\w+Error$/.test(name)) {
        name += 'Error';
    }
    return name;
}
function getErrorNameFromStatusCode ( statusCode ) { statusCode = parseInt ( statusCode , 10 ) ; var status = http . STATUS_CODES [ statusCode ] ; if ( ! status ) { return false ; } var name = '' ; var words = status . split ( / \s+ / ) ; words . forEach ( function ( w ) { name += w . charAt ( 0 ) . toUpperCase ( ) + w . slice ( 1 ) . toLowerCase ( ) ; } ) ; name = name . replace ( / \W+ / g , '' ) ; if ( ! / \w+Error$ / . test ( name ) ) { name += 'Error' ; } return name ; }
Convert status description to error name
Convert status description to error name