How to handle errors on queries?
Closed this issue · 2 comments
volkanunsal commented
I'm curious how to handle an error generated while running the query in the pipe.
stream = client.query(q)
stream.on 'end', done
stream
.pipe(JSONStream.stringify())
.pipe(through2.obj((result)->
....
whitelynx commented
Taking a quick glance at the source, it looks like you should just need to handle the error
event on the stream:
var stream = client.query(q)
.on('end', done)
.on('error', onError)
Since streams propagate errors, you should be able to attach your event handlers even after your .pipe()
calls if you wish.
volkanunsal commented
Thanks @whitelynx