From c04a18a142c5b7f118f64659a9cd57aab053078a 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 --- _js/live_editor.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/_js/live_editor.js b/_js/live_editor.js index e90dec64..7852872a 100644 --- a/_js/live_editor.js +++ b/_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);