pre format only compile time errors (#9538)

* pre format only compile time errors

* Style tweak

(cherry picked from commit 70c01963d9)
This commit is contained in:
Sriram Thiagarajan
2017-05-01 17:23:27 +01:00
committed by Dan Abramov
parent eaadfb856d
commit 08234e7b32
+5 -1
View File
@@ -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);