From 23c75290c7c6da05beafe09196eb2134e33bf958 Mon Sep 17 00:00:00 2001 From: Navy Date: Sun, 19 Apr 2020 22:53:02 +0300 Subject: [PATCH] comments & error handling --- storage/StorageManager.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/storage/StorageManager.js b/storage/StorageManager.js index d4b5714..6448f55 100644 --- a/storage/StorageManager.js +++ b/storage/StorageManager.js @@ -41,6 +41,9 @@ class StorageManager { // Transaction ID concept //`${shard.id}-${new Date().getTime().toString(36)}` + //NULL RESPONSE IF COLLECTION DOES NOT EXIST!! + //EMPTY OBJECT IF NOTHING MATCHED!! + /** Message structure * { * provider: string, -- mongodb or mariadb @@ -60,7 +63,7 @@ class StorageManager { const response = await this.providers.get(message.provider)._query(message.request); - if(response.error) { + if(response && response.error) { this.manager.logger.write('error', `Provider ${message.provider} errored: ${response.message}`, shard); return this._send(shard, response.error); }