ges-client icon indicating copy to clipboard operation
ges-client copied to clipboard

Properly identify operation errors

Open bmavity opened this issue 9 years ago • 0 comments

If a server response message has an .error property, the operation code still identifies it as a successful response and does not report an error.

Code to reproduce an example

var ges = require('ges-client')
    , connection = ges({})

module.exports.readStream = readStream

function readStream(streamName, cb) {
    connection.readStreamEventsForward(streamName, function(err, events) {
        if(err) return cb(err)

        cb(err, events)
    })
}

With response

{ auth: undefined,
  cb: undefined,
  requestType: 'ReadStreamEventsForward',
  toRequestPayload: [Function],
  responseType: 'ReadStreamEventsCompleted',
  toResponseObject: [Function] } { result: 'Error',
  nextEventNumber: -1,
  lastEventNumber: -1,
  isEndOfStream: true,
  lastCommitPosition: '3463749',
  error: 'maxCount should be positive.\nParameter name: maxCount' }

bmavity avatar Aug 29 '15 20:08 bmavity