Skip to content
Snippets Groups Projects
Unverified Commit cccce837 authored by Paul Kaplan's avatar Paul Kaplan Committed by GitHub
Browse files

Merge pull request #4020 from paulkaplan/project-load-fail

Show error screen when project cannot be loaded
parents 80039a03 4d0983a4
Branches
No related tags found
No related merge requests found
...@@ -75,6 +75,10 @@ const ProjectFetcherHOC = function (WrappedComponent) { ...@@ -75,6 +75,10 @@ const ProjectFetcherHOC = function (WrappedComponent) {
.then(projectAsset => { .then(projectAsset => {
if (projectAsset) { if (projectAsset) {
this.props.onFetchedProjectData(projectAsset.data, loadingState); this.props.onFetchedProjectData(projectAsset.data, loadingState);
} else {
// Treat failure to load as an error
// Throw to be caught by catch later on
throw new Error('Could not find project');
} }
}) })
.then(() => { .then(() => {
......
...@@ -48,6 +48,11 @@ describe('Loading scratch gui', () => { ...@@ -48,6 +48,11 @@ describe('Loading scratch gui', () => {
await expect(logs).toEqual([]); await expect(logs).toEqual([]);
}); });
test('Nonexistent projects show error screen', async () => {
await loadUri(`${uri}#999999999999999999999`);
await clickText('Oops! Something went wrong.');
});
test('Invalid url when loading project through modal lets you try again', async () => { test('Invalid url when loading project through modal lets you try again', async () => {
await loadUri(uri); await loadUri(uri);
await clickText('View 2.0 Project'); await clickText('View 2.0 Project');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment