From c1898402fe61a284836527cde6f296ff20e60fbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Renaudeau?= Date: Wed, 11 Jul 2018 18:22:30 +0200 Subject: [PATCH] uncaughtException: no longer exit(1) to investigate an ongoing issue on Windows, we will logger.critical but temporarily no longer exit on a uncaughtException --- src/internals/index.js | 5 ++++- src/logger/logger.js | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/internals/index.js b/src/internals/index.js index 3d72e503..e6b17f04 100644 --- a/src/internals/index.js +++ b/src/internals/index.js @@ -16,7 +16,10 @@ process.on('uncaughtException', err => { type: 'uncaughtException', error: serializeError(err), }) - process.exit(1) + // FIXME we should ideally do this: + // process.exit(1) + // but for now, until we kill all exceptions: + logger.critical(err, 'uncaughtException') }) const defers = {} diff --git a/src/logger/logger.js b/src/logger/logger.js index 7f001def..7105124c 100644 --- a/src/logger/logger.js +++ b/src/logger/logger.js @@ -364,7 +364,13 @@ export default { logger.log('error', ...args) }, - critical: (error: Error) => { + critical: (error: Error, context?: string) => { + if (context) { + captureBreadcrumb({ + category: 'context', + message: context, + }) + } logger.log('error', error) if (!process.env.STORYBOOK_ENV) { try {