From 16512f60fda4c12923229e377d58eb5cbb084661 Mon Sep 17 00:00:00 2001 From: Tobias Gurtzick Date: Fri, 1 Dec 2017 23:04:32 +0100 Subject: [PATCH] fix(log): error ended up in unreadable errors Fixes #524 Fixes #521 --- lib/commands/on-complete.js | 7 +------ lib/driver/index.js | 7 +++---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/commands/on-complete.js b/lib/commands/on-complete.js index 3df484a5..a78d921d 100644 --- a/lib/commands/on-complete.js +++ b/lib/commands/on-complete.js @@ -8,12 +8,7 @@ module.exports = function (migrator, internals, callback, originalErr) { migrator.driver.close(function (err) { if ((err || originalErr) && typeof callback === 'function') { - callback( - new Error({ - err: err, - originalErr: originalErr - }) - ); + callback(originalErr || err); return; } else { assert.ifError(originalErr); diff --git a/lib/driver/index.js b/lib/driver/index.js index 845ec3b7..d927a51b 100644 --- a/lib/driver/index.js +++ b/lib/driver/index.js @@ -74,15 +74,14 @@ exports.connect = function (config, intern, callback) { driver = require(req); } catch (e4) { return callback( - new Error({ - stack: - 'No such driver found, please try to install it via ' + + new Error( + 'No such driver found, please try to install it via ' + 'npm install db-migrate-' + config.driver + ' or ' + 'npm install -g db-migrate-' + config.driver - }) + ) ); } }