From 392d88c5e12d3785f669454dc76729a2455ad147 Mon Sep 17 00:00:00 2001 From: Tobias Gurtzick Date: Sat, 3 Feb 2018 14:47:58 +0100 Subject: [PATCH] fix(switchDatabase): no error was thrown on scope switch switchDatabase error was unhandled, which resulted in an unhandled scope switch error. Fixes #470 Signed-off-by: Tobias Gurtzick --- connect.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/connect.js b/connect.js index 2d2ae894..590aadc9 100644 --- a/connect.js +++ b/connect.js @@ -39,7 +39,10 @@ exports.connect = function (config, PassedClass, callback) { } catch (e) {} if (switched) { - db.switchDatabase(newConf, function () { + db.switchDatabase(newConf, function (err) { + if (err) { + return callback(err); + } internals.locTitle = internals.migrationMode; callback( null,