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 // XXX: implement handling of rejectedFiles
const reader = new FileReader(); const reader = new FileReader();
reader.onabort = () => alert('file reading was aborted'); reader.onabort = () => {
reader.onerror = () => alert('file reading has failed'); 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 = () => { reader.onload = () => {
try { try {
const fileText = reader.result as string; const fileText = reader.result as string;

Loading…
Cancel
Save