Skip to content
Snippets Groups Projects
Commit 5f1fe572 authored by chrisgarrity's avatar chrisgarrity
Browse files

Nicer crash message format

fixes #1205.

It doesn’t translate any of the text to avoid a case where translation is causing the error, and fails in the error boundary as well.
parent c4ab9d51
No related branches found
No related tags found
No related merge requests found
@import "../../css/colors.css";
@import "../../css/units.css";
@import "../../css/typography.css";
.crash-wrapper {
background-color: $motion-primary;
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.body {
width: 35%;
color: white;
text-align: center;
}
.reloadButton {
border: 1px solid $motion-primary;
border-radius: 0.25rem;
padding: 0.5rem 2rem;
background: white;
color: $motion-primary;
font-weight: bold;
font-size: 0.875rem;
cursor: pointer;
}
import PropTypes from 'prop-types';
import React from 'react';
import Box from '../box/box.jsx';
import styles from './crash-message.css';
import reloadIcon from './reload.svg';
const CrashMessage = props => (
<div className={styles.crashWrapper}>
<Box className={styles.body}>
<img
className={styles.reloadIcon}
src={reloadIcon}
/>
<h2>
Oops! Something went wrong.
</h2>
<p>
We are so sorry, but it looks like Scratch has crashed. This bug has been
automatically reported to the Scratch Team. Please refresh your page to try
again.
</p>
<button
className={styles.reloadButton}
onClick={props.onReload}
>
Reload
</button>
</Box>
</div>
);
CrashMessage.propTypes = {
onReload: PropTypes.func.isRequired
};
export default CrashMessage;
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
......@@ -2,6 +2,7 @@ import React from 'react';
import PropTypes from 'prop-types';
import platform from 'platform';
import BrowserModalComponent from '../components/browser-modal/browser-modal.jsx';
import CrashMessageComponent from '../components/crash-message/crash-message.jsx';
import log from '../lib/log.js';
import analytics from '../lib/analytics';
......@@ -28,21 +29,16 @@ class ErrorBoundary extends React.Component {
window.history.back();
}
handleReload () {
window.location.reload();
}
render () {
if (this.state.hasError) {
if (platform.name === 'IE') {
return <BrowserModalComponent onBack={this.handleBack} />;
}
return (
<div style={{margin: '2rem'}}>
<h1>Oops! Something went wrong.</h1>
<p>
We are so sorry, but it looks like Scratch has crashed. This bug has been
automatically reported to the Scratch Team. Please refresh your page to try
again.
</p>
</div>
);
return <CrashMessageComponent onReload={this.handleReload} />;
}
return this.props.children;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment