diff --git a/src/actions/index.js b/src/actions/index.js index 368f723..619cf87 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -59,14 +59,14 @@ function triggerDefaultState(dispatch, getState) { try { MultiGraph.overallOrder(); - } catch(err) { + } catch (err) { dispatch( onError({ type: 'backEnd', error: { message: 'Circular Dependencies', html: err.toString(), - } + }, }) ); } @@ -673,7 +673,9 @@ function updateOutput( if (res.status !== STATUS.OK) { // update the status of this request updateRequestQueue(true, res.status); - return; + + // eject into `catch` handler below + throw res; } /* @@ -903,7 +905,7 @@ function updateOutput( }); }) .catch(err => { - // Handle html & JSON error responses + // Handle html error responses err.text().then(text => { dispatch( onError({ diff --git a/src/components/error/FrontEnd/FrontEndError.css b/src/components/error/FrontEnd/FrontEndError.css index 3506d06..258cada 100644 --- a/src/components/error/FrontEnd/FrontEndError.css +++ b/src/components/error/FrontEnd/FrontEndError.css @@ -1,3 +1,7 @@ +.error-container { + margin-top: 10px; +} + .dash-fe-errors { min-width: 386px; max-width: 650px; @@ -5,7 +9,6 @@ display: inline-block; } - .dash-fe-error__icon-error { width: 20px; height: 20px; @@ -32,6 +35,13 @@ width: 100%; cursor: pointer; } +.dash-fe-error-top__group:first-child { + /* + * 77% is the maximum space allowed based off of the other elements + * in the top part of the error container (timestamp & collapse arrow). + * this was manually determined */ + width: 77%; +} .dash-fe-error-top__group { display: inline-flex; align-items: center; @@ -42,9 +52,12 @@ padding: 0px; font-size: 14px; display: inline-block; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; } .dash-fe-error__timestamp { - margin-right: 30px; + margin-right: 20px; } .dash-fe-error__collapse--flipped { -webkit-transform: rotate(180deg); @@ -52,15 +65,43 @@ transform: rotate(180deg); } -.dash-fe-error__st { - background-color: #fdf3f4; - min-width: 386px; - max-width: 650px; - max-height: 450px; +.dash-fe-error__info_title { + margin: 0; + color: #506784; + font-size: 16px; + background-color: #f3f6fa; + border: 2px solid #dfe8f3; + box-sizing: border-box; + border-top-left-radius: 4px; + border-top-right-radius: 4px; + padding: 10px; +} + +.dash-fe-error__info { + border: 1px solid #dfe8f3; + margin: 0 0 1em 0; + padding: 10px; + + background-color: white; + border: 2px solid #dfe8f3; + border-radius: 0px 0px 4px 4px; + color: #506784; overflow: scroll; - padding: 2rem; - margin-top: 8px; - display: inline-block; +} + +.dash-fe-error__curved { + border-radius: 4px; +} + +.dash-fe-error__curved-top { + border-top-left-radius: 4px; + border-top-right-radius: 4px; + border-bottom-width: 0px; +} + +.dash-fe-error__curved-bottom { + border-radius-bottom-left: 4px; + border-radius-bottom-right: 4px; } .dash-be-error__st { diff --git a/src/components/error/FrontEnd/FrontEndError.react.js b/src/components/error/FrontEnd/FrontEndError.react.js index 15abd58..b1856f3 100644 --- a/src/components/error/FrontEnd/FrontEndError.react.js +++ b/src/components/error/FrontEnd/FrontEndError.react.js @@ -34,7 +34,6 @@ class FrontEndError extends Component { onClick={() => this.setState({collapsed: !collapsed})} > - ☣️  {e.error.message || 'Error'} @@ -60,22 +59,35 @@ class FrontEndError extends Component { ) : (
{errorHeader} - +
); } } /* eslint-disable no-inline-comments */ -function ErrorContent({error}) { +function ErrorContent({error, type}) { return (
- {/* Frontend Error objects */} + {!error.message || type === 'backEnd' ? null : ( +
+
+ {error.message} +
+
+ )} + {!error.stack ? null : (
- {error.stack.split('\n').map(line => ( -

{line}

- ))} +
+ {"JS Stack trace (see browser's console for details)"} +
+
+
+ {error.stack.split('\n').map(line => ( +

{line}

+ ))} +
)} {/* Backend Error */} @@ -123,12 +135,14 @@ const errorPropTypes = PropTypes.shape({ ErrorContent.propTypes = { error: errorPropTypes, + type: PropTypes.oneOf(['backEnd', 'frontEnd']), }; FrontEndError.propTypes = { e: PropTypes.shape({ myUID: PropTypes.string, timestamp: PropTypes.object, + type: PropTypes.oneOf(['backEnd', 'frontEnd']), error: errorPropTypes, }), resolve: PropTypes.func, diff --git a/src/components/error/menu/DebugAlertContainer.react.js b/src/components/error/menu/DebugAlertContainer.react.js index 3557ad9..68b0ce5 100644 --- a/src/components/error/menu/DebugAlertContainer.react.js +++ b/src/components/error/menu/DebugAlertContainer.react.js @@ -20,7 +20,7 @@ class DebugAlertContainer extends Component { {alertsOpened ? ( ) : ( - '☣️' + '🛑 ' )} {this.props.errors.length}
diff --git a/src/components/error/menu/DebugMenu.css b/src/components/error/menu/DebugMenu.css index 0bfc8dc..8a7aad5 100644 --- a/src/components/error/menu/DebugMenu.css +++ b/src/components/error/menu/DebugMenu.css @@ -19,6 +19,7 @@ 0px 1px 3px rgba(162, 177, 198, 0.32); border-radius: 4px; padding: 12px 0px; + background-color: white; } .dash-debug-menu--closed:hover { diff --git a/src/components/error/menu/DebugMenu.react.js b/src/components/error/menu/DebugMenu.react.js index 69d19fb..eda8c13 100644 --- a/src/components/error/menu/DebugMenu.react.js +++ b/src/components/error/menu/DebugMenu.react.js @@ -93,9 +93,8 @@ class DebugMenu extends Component { error.frontEnd.length + error.backEnd.length > 0 && !opened ? (
- ☣️ {error.frontEnd.length + error.backEnd.length} + 🛑  {error.frontEnd.length + error.backEnd.length}
-
⚠️ 0
) : null;