mirror of
https://github.com/scratchfoundation/scratch-desktop.git
synced 2024-12-22 21:52:31 -05:00
handle initial project load errors
This commit is contained in:
parent
a9933242e0
commit
0fa4c4b2ed
1 changed files with 13 additions and 5 deletions
|
@ -1,4 +1,4 @@
|
||||||
import {ipcRenderer, shell} from 'electron';
|
import {ipcRenderer, remote, shell} from 'electron';
|
||||||
import bindAll from 'lodash.bindall';
|
import bindAll from 'lodash.bindall';
|
||||||
import omit from 'lodash.omit';
|
import omit from 'lodash.omit';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
@ -70,11 +70,19 @@ const ScratchDesktopHOC = function (WrappedComponent) {
|
||||||
},
|
},
|
||||||
e => {
|
e => {
|
||||||
this.props.onLoadingCompleted();
|
this.props.onLoadingCompleted();
|
||||||
console.error(e); // TODO: dialog box reporting the error?
|
|
||||||
|
|
||||||
// abandon this load and instead fetch+load the default project
|
|
||||||
// WARNING: this stuff doesn't currently work correctly!
|
|
||||||
this.props.onLoadedProject(this.props.loadingState, false);
|
this.props.onLoadedProject(this.props.loadingState, false);
|
||||||
|
remote.dialog.showMessageBox(remote.getCurrentWindow(), {
|
||||||
|
type: 'error',
|
||||||
|
title: 'Failed to load project',
|
||||||
|
message: 'Invalid or corrupt project file.',
|
||||||
|
detail: e.message
|
||||||
|
});
|
||||||
|
|
||||||
|
// this effectively sets the default project ID
|
||||||
|
// TODO: maybe setting the default project ID should be implicit in `requestNewProject`
|
||||||
|
this.props.onHasInitialProject(false, this.props.loadingState);
|
||||||
|
|
||||||
|
// restart as if we didn't have an initial project to load
|
||||||
this.props.onRequestNewProject();
|
this.props.onRequestNewProject();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue