function ifStatusOk(response, fulfill, reject) {
    var responseCode = response.code;
    if (isClientError(responseCode)) {
        reject({name : "ClientErrorException", message : response.body});
    } else if (isServerError(responseCode)) {
        reject({name : "ServerErrorException", message : response.error});
    } else if (isOtherErrorResponse(responseCode)) {
        reject({name : "OtherCommunicationException", message : response.error});
    } else {
        fulfill(response.body)
    }
}
function ifStatusOk(response, fulfill, reject) {
    var responseCode = response.code;
    if (isClientError(responseCode)) {
        reject({name : "ClientErrorException", message : response.body});
    } else if (isServerError(responseCode)) {
        reject({name : "ServerErrorException", message : response.error});
    } else if (isOtherErrorResponse(responseCode)) {
        reject({name : "OtherCommunicationException", message : response.error});
    } else {
        fulfill(response.body)
    }
}
function ifStatusOk ( response , fulfill , reject ) { var responseCode = response . code ; if ( isClientError ( responseCode ) ) { reject ( { name : "ClientErrorException" , message : response . body } ) ; } else if ( isServerError ( responseCode ) ) { reject ( { name : "ServerErrorException" , message : response . error } ) ; } else if ( isOtherErrorResponse ( responseCode ) ) { reject ( { name : "OtherCommunicationException" , message : response . error } ) ; } else { fulfill ( response . body ) } }
~~~~~~~ Error handling ~~~~~~~~~
~~~~~~~ Error handling ~~~~~~~~~