messages from query

This commit is contained in:
Jan Prochazka
2020-04-10 13:49:41 +02:00
parent f01bf8a605
commit aa2eae2696
6 changed files with 89 additions and 38 deletions

View File

@@ -14,7 +14,7 @@ class StreamHandler {
constructor() {
this.recordset = this.recordset.bind(this);
this.row = this.row.bind(this);
this.error = this.error.bind(this);
// this.error = this.error.bind(this);
this.done = this.done.bind(this);
this.info = this.info.bind(this);
}
@@ -38,9 +38,9 @@ class StreamHandler {
// console.log('ACCEPT ROW', row);
this.currentStream.write(JSON.stringify(row) + '\n');
}
error(error) {
process.send({ msgtype: 'error', error });
}
// error(error) {
// process.send({ msgtype: 'error', error });
// }
done(result) {
this.closeCurrentStream();
process.send({ msgtype: 'done', result });
@@ -91,7 +91,14 @@ function start() {
try {
await handleMessage(message);
} catch (e) {
process.send({ msgtype: 'error', error: e.message });
process.send({
msgtype: 'info',
info: {
message: e.message,
severity: 'error',
},
});
//process.send({ msgtype: 'error', error: e.message });
}
});
}