Show a nicer dialog for sync errors.

master
Tom Hacohen 4 years ago
parent d4a05faa0a
commit b370c59184

@ -22,7 +22,6 @@ import "react-virtualized/styles.css"; // only needs to be imported once
import "./App.css"; import "./App.css";
import ConfirmationDialog from "./widgets/ConfirmationDialog"; import ConfirmationDialog from "./widgets/ConfirmationDialog";
import PrettyError from "./widgets/PrettyError";
import { List, ListItem } from "./widgets/List"; import { List, ListItem } from "./widgets/List";
import withSpin from "./widgets/withSpin"; import withSpin from "./widgets/withSpin";
import ErrorBoundary from "./components/ErrorBoundary"; import ErrorBoundary from "./components/ErrorBoundary";
@ -198,7 +197,7 @@ export default function App() {
iconElementRight={ iconElementRight={
<> <>
{(errors.size > 0) && ( {(errors.size > 0) && (
<IconButton onClick={() => setErrorsDialog(true)} title="Parse Errors"> <IconButton onClick={() => setErrorsDialog(true)} title="Errors">
<Badge badgeContent={errors.size} color="error"> <Badge badgeContent={errors.size} color="error">
<ErrorsIcon /> <ErrorsIcon />
</Badge> </Badge>
@ -211,14 +210,14 @@ export default function App() {
} }
/> />
<ConfirmationDialog <ConfirmationDialog
title="Parse Errors" title="Sync Errors"
open={errorsDialog} open={errorsDialog}
labelOk="OK" labelOk="OK"
onCancel={() => setErrorsDialog(false)} onCancel={() => setErrorsDialog(false)}
onOk={() => setErrorsDialog(false)} onOk={() => setErrorsDialog(false)}
> >
<h4> <h4>
This should not happen, please contact developers! Please contact developers if any of the errors below persist.
</h4> </h4>
<List> <List>
{errors.map((error, index) => ( {errors.map((error, index) => (
@ -227,7 +226,7 @@ export default function App() {
style={{ height: "unset" }} style={{ height: "unset" }}
onClick={() => (window as any).navigator.clipboard.writeText(`${error.message}\n\n${error.stack}`)} onClick={() => (window as any).navigator.clipboard.writeText(`${error.message}\n\n${error.stack}`)}
> >
<PrettyError error={error} /> {error.message}
</ListItem> </ListItem>
))} ))}
</List> </List>

Loading…
Cancel
Save