diff --git a/src/lib/project-fetcher-hoc.jsx b/src/lib/project-fetcher-hoc.jsx index 9f82fb3d7b878a9f9c430ccf67b5f0d080148a92..2998b75cd1672587779a0a7b5a69a196de0a0f5d 100644 --- a/src/lib/project-fetcher-hoc.jsx +++ b/src/lib/project-fetcher-hoc.jsx @@ -75,6 +75,10 @@ const ProjectFetcherHOC = function (WrappedComponent) { .then(projectAsset => { if (projectAsset) { 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(() => { diff --git a/test/integration/project-loading.test.js b/test/integration/project-loading.test.js index 687e11b1314ed01b8ba5039f9da4cc0b41c41098..a3b4923343439b1c4a469008e5db7997b9f5c660 100644 --- a/test/integration/project-loading.test.js +++ b/test/integration/project-loading.test.js @@ -48,6 +48,11 @@ describe('Loading scratch gui', () => { 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 () => { await loadUri(uri); await clickText('View 2.0 Project');