ges-client
ges-client copied to clipboard
Properly identify operation errors
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' }