aboutsummaryrefslogtreecommitdiff
path: root/query-executor.js
diff options
context:
space:
mode:
authorJames Barnett <noreply@jamesbarnett.xyz>2018-02-21 21:28:39 +0000
committerJames Barnett <noreply@jamesbarnett.xyz>2018-02-21 21:28:39 +0000
commit703f78867653ed9c53a745f9808eb96ae8a89dc7 (patch)
treede0a90c201f1949e701c969b2a3a94d7015f4006 /query-executor.js
parent4ef675b2b7803c72ed6e74ee13841e356a71f103 (diff)
downloadsql-plus-plus-703f78867653ed9c53a745f9808eb96ae8a89dc7.tar.xz
sql-plus-plus-703f78867653ed9c53a745f9808eb96ae8a89dc7.zip
Ensure query error messages survive the IPC serialisaiontabbed-interface
Diffstat (limited to 'query-executor.js')
-rw-r--r--query-executor.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/query-executor.js b/query-executor.js
index 0c5b440..88df7e1 100644
--- a/query-executor.js
+++ b/query-executor.js
@@ -23,8 +23,14 @@ ipcRenderer.on("queryExecutor.runQuery", (event, payload) => {
if(payload.queryExecutorId === executorId) {
connectionPool.query(payload.query, (err, res) => {
- console.log(err, res)
+ console.log(err, res);
+ if(err !== undefined) {
+ // The IPC payload is serialised to JSON beofre transmisison, so the protoype chain is lost.
+ // So store the nicely formatted error message as a property.
+ err.cause = err.toString();
+ }
+
ipcRenderer.send("queryExecutor.runQueryComplete", {
"error": err,
"result": res,