node.js/lib/client/client.js
function isOk(err, res, body) {
    if (err) {
      return callback(err);
    }

    var statusCode = res.statusCode.toString(),
        error;

    //
    //  Emit response for debug purpose
    //
    self.emit('debug::response', { statusCode: statusCode, result: body });

    if (Object.keys(self.failCodes).indexOf(statusCode) !== -1) {
      error = new Error('composer Error (' + statusCode + '): ' + self.failCodes[statusCode]);
      if (body) {
        try { error.result = JSON.parse(body) }
        catch (ex) {}
      }
      error.status = res.statusCode;
      callback(error);
      return false
    }

    return true;
  }
function isOk(err, res, body) {
    if (err) {
      return callback(err);
    }

    var statusCode = res.statusCode.toString(),
        error;

    //
    //  Emit response for debug purpose
    //
    self.emit('debug::response', { statusCode: statusCode, result: body });

    if (Object.keys(self.failCodes).indexOf(statusCode) !== -1) {
      error = new Error('composer Error (' + statusCode + '): ' + self.failCodes[statusCode]);
      if (body) {
        try { error.result = JSON.parse(body) }
        catch (ex) {}
      }
      error.status = res.statusCode;
      callback(error);
      return false
    }

    return true;
  }
function isOk ( err , res , body ) { if ( err ) { return callback ( err ) ; } var statusCode = res . statusCode . toString ( ) , error ; // //  Emit response for debug purpose // self . emit ( 'debug::response' , { statusCode : statusCode , result : body } ) ; if ( Object . keys ( self . failCodes ) . indexOf ( statusCode ) !== - 1 ) { error = new Error ( 'composer Error (' + statusCode + '): ' + self . failCodes [ statusCode ] ) ; if ( body ) { try { error . result = JSON . parse ( body ) } catch ( ex ) { } } error . status = res . statusCode ; callback ( error ) ; return false } return true ; }
Helper function for checking response codes
Helper function for checking response codes