From cf0cb171af73b90f117ae0d7d68b2032a5846bbe Mon Sep 17 00:00:00 2001 From: Felix Becker Date: Mon, 24 Apr 2023 17:04:40 -0400 Subject: [PATCH] Log additional error properties --- lib/commands/helper/register-events.js | 4 ++-- lib/commands/on-complete.js | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/commands/helper/register-events.js b/lib/commands/helper/register-events.js index abaae13a..c19e3cdb 100644 --- a/lib/commands/helper/register-events.js +++ b/lib/commands/helper/register-events.js @@ -5,13 +5,13 @@ var log = require('db-migrate-shared').log; function registerEvents () { process.on('uncaughtException', function (err) { log.error('uncaughtException'); - log.error(err.stack || err); + log.error(err); process.exit(1); }); process.on('unhandledRejection', function (reason) { log.error('unhandledRejection'); - log.error(reason.stack || reason); + log.error(reason); process.exit(1); }); } diff --git a/lib/commands/on-complete.js b/lib/commands/on-complete.js index fbb2cb57..267ae962 100644 --- a/lib/commands/on-complete.js +++ b/lib/commands/on-complete.js @@ -10,6 +10,7 @@ module.exports = function (migrator, internals, originalErr, results) { callback(originalErr || err); return; } else { + if (originalErr instanceof Error) throw originalErr; assert.ifError(originalErr); assert.ifError(err); log.info('Done');