You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am attempting to do simple data validation within a .on('data') callback, and when I bump in to an error, I would like to stop the parsing. I've attempted to throw an error, but it seems that it bubbles up out of the csv package, ie. is not caught and passed on to .on('error').
csv().from('...').on('data',function(data,index){thrownewError('insufficient data in message');}).on('error',function(err){console.log('I never get called :(');});
The stacktrace I am getting is
Error: insufficient data in message
at [object Object].<anonymous> (/Users/gudmundur/Development/CSharp/Sources/vmkerfi/tools.ssBridge/lib/bridge.coffee:114:35)
at [object Object].emit (events.js:70:17)
at write (/Users/gudmundur/Development/CSharp/Sources/vmkerfi/tools.ssBridge/node_modules/csv/lib/csv.js:222:17)
at flush (/Users/gudmundur/Development/CSharp/Sources/vmkerfi/tools.ssBridge/node_modules/csv/lib/csv.js:409:9)
at [object Object].end (/Users/gudmundur/Development/CSharp/Sources/vmkerfi/tools.ssBridge/node_modules/csv/lib/csv.js:143:17)
at Array.0 (/Users/gudmundur/Development/CSharp/Sources/vmkerfi/tools.ssBridge/node_modules/csv/lib/csv.js:83:18)
at EventEmitter._tickCallback (node.js:192:40)
Am I going about this the wrong way or is this an actual issue?
The text was updated successfully, but these errors were encountered:
I can stop parsing even if an error is thrown and caught with on('error'). The data event is emitted again and again for each line. How can I stop the parsing.. ?
I am attempting to do simple data validation within a
.on('data')
callback, and when I bump in to an error, I would like to stop the parsing. I've attempted to throw an error, but it seems that it bubbles up out of the csv package, ie. is not caught and passed on to.on('error')
.The stacktrace I am getting is
Am I going about this the wrong way or is this an actual issue?
The text was updated successfully, but these errors were encountered: