Import: fix error handling to stop the loading and print the error.

master
Tom Hacohen 5 years ago
parent d268c0fab6
commit d8a0aa19ca

@ -106,8 +106,16 @@ class ImportDialog extends React.Component<PropsType> {
// XXX: implement handling of rejectedFiles
const reader = new FileReader();
reader.onabort = () => alert('file reading was aborted');
reader.onerror = () => alert('file reading has failed');
reader.onabort = () => {
this.setState({ loading: false });
console.error('Import Aborted');
alert('file reading was aborted');
};
reader.onerror = (e) => {
this.setState({ loading: false });
console.error(e);
alert('file reading has failed');
};
reader.onload = () => {
try {
const fileText = reader.result as string;

Loading…
Cancel
Save