From 5b5bd5eb75f96630148bc337f163aa517c6bb89e Mon Sep 17 00:00:00 2001 From: Ben Alpert Date: Sat, 14 May 2016 12:12:19 -0700 Subject: [PATCH] Print stack in devtool exception warning (#6768) --- src/isomorphic/ReactDebugTool.js | 2 +- src/isomorphic/__tests__/ReactDebugTool-test.js | 2 +- src/renderers/dom/shared/ReactDOMDebugTool.js | 2 +- src/renderers/dom/shared/__tests__/ReactDOMDebugTool-test.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/isomorphic/ReactDebugTool.js b/src/isomorphic/ReactDebugTool.js index 7d55bab6df..d81ab6ee16 100644 --- a/src/isomorphic/ReactDebugTool.js +++ b/src/isomorphic/ReactDebugTool.js @@ -31,7 +31,7 @@ function emitEvent(handlerFunctionName, arg1, arg2, arg3, arg4, arg5) { handlerDoesThrowForEvent[handlerFunctionName], 'exception thrown by devtool while handling %s: %s', handlerFunctionName, - e.message + e + '\n' + e.stack ); handlerDoesThrowForEvent[handlerFunctionName] = true; } diff --git a/src/isomorphic/__tests__/ReactDebugTool-test.js b/src/isomorphic/__tests__/ReactDebugTool-test.js index 889b909798..81582623fe 100644 --- a/src/isomorphic/__tests__/ReactDebugTool-test.js +++ b/src/isomorphic/__tests__/ReactDebugTool-test.js @@ -66,7 +66,7 @@ describe('ReactDebugTool', function() { expect(console.error.calls.length).toBe(1); expect(console.error.argsForCall[0][0]).toContain( 'exception thrown by devtool while handling ' + - 'onTestEvent: Hi.' + 'onTestEvent: Error: Hi.' ); ReactDebugTool.onTestEvent(); diff --git a/src/renderers/dom/shared/ReactDOMDebugTool.js b/src/renderers/dom/shared/ReactDOMDebugTool.js index 5849b40b93..23d3fbf116 100644 --- a/src/renderers/dom/shared/ReactDOMDebugTool.js +++ b/src/renderers/dom/shared/ReactDOMDebugTool.js @@ -31,7 +31,7 @@ function emitEvent(handlerFunctionName, arg1, arg2, arg3, arg4, arg5) { handlerDoesThrowForEvent[handlerFunctionName], 'exception thrown by devtool while handling %s: %s', handlerFunctionName, - e.message + e + '\n' + e.stack ); handlerDoesThrowForEvent[handlerFunctionName] = true; } diff --git a/src/renderers/dom/shared/__tests__/ReactDOMDebugTool-test.js b/src/renderers/dom/shared/__tests__/ReactDOMDebugTool-test.js index b4a94ec837..3aa28ec057 100644 --- a/src/renderers/dom/shared/__tests__/ReactDOMDebugTool-test.js +++ b/src/renderers/dom/shared/__tests__/ReactDOMDebugTool-test.js @@ -66,7 +66,7 @@ describe('ReactDOMDebugTool', function() { expect(console.error.calls.length).toBe(1); expect(console.error.argsForCall[0][0]).toContain( 'exception thrown by devtool while handling ' + - 'onTestEvent: Hi.' + 'onTestEvent: Error: Hi.' ); ReactDOMDebugTool.onTestEvent();