From 08234e7b32e4fd886eaceebec6c69a2ad9468cd3 Mon Sep 17 00:00:00 2001 From: Sriram Thiagarajan Date: Thu, 27 Apr 2017 16:19:34 +0530 Subject: [PATCH] pre format only compile time errors (#9538) * pre format only compile time errors * Style tweak (cherry picked from commit 70c01963d9a5c8d6789559334bbf558aee976632) --- docs/_js/live_editor.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/_js/live_editor.js b/docs/_js/live_editor.js index 9f1952aeb6..d2d8390539 100644 --- a/docs/_js/live_editor.js +++ b/docs/_js/live_editor.js @@ -219,9 +219,13 @@ var ReactPlayground = React.createClass({ eval(compiledCode); } } catch (err) { + // Babel errors are preformatted, runtime errors are not. + const errorMessage = err._babel ? +
{err.toString()}
: +
{err.toString()}
; this.setTimeout(function() { ReactDOM.render( -
{err.toString()}
, + errorMessage, mountNode ); }, 500);