pre format only compile time errors (#9538)
* pre format only compile time errors * Style tweak
Sriram Thiagarajan committed
Apr 27, 2017 at 16:19 UTC
70c01963d9a5c8d6789559334bbf558aee976632
1 file changed
+5
-1
docs/_js/live_editor.js
+5
-1
@@ -219,9 +219,13 @@ var ReactPlayground = React.createClass({
219
eval(compiledCode);
220
}
221
} catch (err) {
222
+ // Babel errors are preformatted, runtime errors are not.
223
+ const errorMessage = err._babel ?
224
+ <pre style={{overflowX: 'auto'}} className="playgroundError">{err.toString()}</pre> :
225
+ <div className="playgroundError">{err.toString()}</div>;
226
this.setTimeout(function() {
227
ReactDOM.render(
224
- <pre style={{overflowX: 'auto'}} className="playgroundError">{err.toString()}</pre>,
228
+ errorMessage,
229
mountNode
230
);
231
}, 500);