index.js
function handleError(body, response, callback) {
    var error;
    if (!body) {
        response.pipe(concat(function (body) {
            body = parseJSONBody(body);
            error = body.message || statusText(response.statusCode);
            callback(new Error(error), body, response);
        }));
    } else {
        error = body.message || statusText(response.statusCode);
        callback(new Error(error), body, response);
    }
}
function handleError(body, response, callback) {
    var error;
    if (!body) {
        response.pipe(concat(function (body) {
            body = parseJSONBody(body);
            error = body.message || statusText(response.statusCode);
            callback(new Error(error), body, response);
        }));
    } else {
        error = body.message || statusText(response.statusCode);
        callback(new Error(error), body, response);
    }
}
function handleError ( body , response , callback ) { var error ; if ( ! body ) { response . pipe ( concat ( function ( body ) { body = parseJSONBody ( body ) ; error = body . message || statusText ( response . statusCode ) ; callback ( new Error ( error ) , body , response ) ; } ) ) ; } else { error = body . message || statusText ( response . statusCode ) ; callback ( new Error ( error ) , body , response ) ; } }
Create an error object from the response and call the callback function
@param   {Object}   body     The parsed response body (or null if not yet parsed)
@param   {Response} response The HTTP response object
@param   {Function} callback Function to call with the resulting error object
@returns {void}
Create an error object from the response and call the callback function