Browse Source

pre format only compile time errors (#9538)

* pre format only compile time errors

* Style tweak
main
Sriram Thiagarajan 8 years ago
committed by Dan Abramov
parent
commit
c04a18a142
  1. 6
      _js/live_editor.js

6
_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 ?
<pre style={{overflowX: 'auto'}} className="playgroundError">{err.toString()}</pre> :
<div className="playgroundError">{err.toString()}</div>;
this.setTimeout(function() {
ReactDOM.render(
<pre style={{overflowX: 'auto'}} className="playgroundError">{err.toString()}</pre>,
errorMessage,
mountNode
);
}, 500);

Loading…
Cancel
Save