-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue #275 of bad error handling.
- Loading branch information
Showing
9 changed files
with
147 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
'use strict'; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
|
||
var _react = require('react'); | ||
|
||
var _react2 = _interopRequireDefault(_react); | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
|
||
var mainStyle = { | ||
position: 'fixed', | ||
top: 0, bottom: 0, left: 0, right: 0, | ||
padding: 20, | ||
backgroundColor: 'rgb(187, 49, 49)', | ||
color: '#FFF', | ||
fontFamily: '\n -apple-system, ".SFNSText-Regular", "San Francisco", Roboto, "Segoe UI",\n "Helvetica Neue", "Lucida Grande", sans-serif\'\n ' | ||
}; | ||
|
||
var headingStyle = { | ||
fontFamily: 'inherit', | ||
fontSize: 20, | ||
fontWeight: 600, | ||
letterSpacing: 'normal', | ||
margin: '10px 0' | ||
}; | ||
|
||
var codeStyle = { | ||
fontSize: 14, | ||
width: '100vw', | ||
overflow: 'auto' | ||
}; | ||
|
||
var ErrorDisplay = function ErrorDisplay(_ref) { | ||
var error = _ref.error; | ||
return _react2.default.createElement( | ||
'div', | ||
{ style: mainStyle, __self: undefined | ||
}, | ||
_react2.default.createElement( | ||
'div', | ||
{ style: headingStyle, __self: undefined | ||
}, | ||
error.message | ||
), | ||
_react2.default.createElement( | ||
'pre', | ||
{ style: codeStyle, __self: undefined | ||
}, | ||
_react2.default.createElement( | ||
'code', | ||
{ | ||
__self: undefined | ||
}, | ||
error.stack | ||
) | ||
) | ||
); | ||
}; | ||
|
||
ErrorDisplay.propTypes = { | ||
error: _react2.default.PropTypes.object.isRequired | ||
}; | ||
|
||
exports.default = ErrorDisplay; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React from 'react'; | ||
|
||
const mainStyle = { | ||
position: 'fixed', | ||
top: 0, bottom: 0, left: 0, right: 0, | ||
padding: 20, | ||
backgroundColor: 'rgb(187, 49, 49)', | ||
color: '#FFF', | ||
fontFamily: ` | ||
-apple-system, ".SFNSText-Regular", "San Francisco", Roboto, "Segoe UI", | ||
"Helvetica Neue", "Lucida Grande", sans-serif' | ||
`, | ||
}; | ||
|
||
const headingStyle = { | ||
fontFamily: 'inherit', | ||
fontSize: 20, | ||
fontWeight: 600, | ||
letterSpacing: 'normal', | ||
margin: '10px 0', | ||
}; | ||
|
||
const codeStyle = { | ||
fontSize: 14, | ||
width: '100vw', | ||
overflow: 'auto', | ||
}; | ||
|
||
const ErrorDisplay = ({ error }) => ( | ||
<div style={mainStyle}> | ||
<div style={headingStyle}>{error.message}</div> | ||
<pre style={codeStyle}> | ||
<code> | ||
{error.stack} | ||
</code> | ||
</pre> | ||
</div> | ||
); | ||
|
||
ErrorDisplay.propTypes = { | ||
error: React.PropTypes.object.isRequired, | ||
}; | ||
|
||
export default ErrorDisplay; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters