From 94648ee759f1c49db99f5307d250a45369070256 Mon Sep 17 00:00:00 2001 From: Benjamin Leclerc Date: Wed, 20 Nov 2019 10:21:21 +0000 Subject: [PATCH] Improve error handling --- src/websocket.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/websocket.js b/src/websocket.js index e4669bc..cc3a23a 100644 --- a/src/websocket.js +++ b/src/websocket.js @@ -37,14 +37,20 @@ function connectWebSocket(url, options, redisClient) { ws.send(JSON.stringify({ messageId: message.messageId, status: 400, - data: e.toString() + data: { + code: 'redis_execution', + message: e.toString() + } })); } } else { ws.send(JSON.stringify({ messageId: message.messageId, status: 405, - data: null + data: { + code: 'redis_not_connected', + message: 'Redis instance is not connected' + } })); } }