When trying to make a query with a problem in the query eg. wrong columnname while in Stream mode event.js throws an error which can not be catched. Subscription to the "error" event will be processed but the underlying error will still be thrown. The error can not be catched in the query callback nor promise and leads to App Crash.
Expected behaviour:
Error should only be thrown through error Eventhandler or Promise/Callback.
Actual behaviour:
Error is thrown in error Event and within events.js:
events.js:174
throw er; // Unhandled 'error' event
^
RequestError: Incorrect syntax near the keyword 'Table'.
Configuration:
sql
.connect(connection)
.then(pool => {
let request = pool.request();
request.stream = true;
let sql = "SELECT nonsense FROM Table";
let ws = fs.createWriteStream("output.txt");
request.on("error", err => {
console.log("Error in Stream", err.code);
});
request.pipe(through).pipe(ws);
request.query(sql).catch(err => {
console.log("error in Promise", err.code);
});
});
Software versions
- NodeJS: 10.17.0
- node-mssql: 6.1.0
- SQL Server: 2017
- Driver: Tedious
When trying to make a query with a problem in the query eg. wrong columnname while in Stream mode event.js throws an error which can not be catched. Subscription to the "error" event will be processed but the underlying error will still be thrown. The error can not be catched in the query callback nor promise and leads to App Crash.
Expected behaviour:
Error should only be thrown through error Eventhandler or Promise/Callback.
Actual behaviour:
Error is thrown in error Event and within events.js:
Configuration:
Software versions