Merge branch '487-async-route-errors' of https://github.com/nikku/sapper into nikku-487-async-route-errors

This commit is contained in:
Rich Harris
2018-10-24 20:58:52 -04:00
3 changed files with 18 additions and 1 deletions

View File

@@ -0,0 +1,3 @@
export function get(req, res) {
return Promise.reject(new Error('oops'));
}

View File

@@ -112,6 +112,15 @@ describe('errors', function() {
);
});
it('does not serve error page for async non-page error', async () => {
await page.goto(`${base}/async-throw.json`);
assert.equal(
await page.evaluate(() => document.body.textContent),
'oops'
);
});
it('clears props.error on successful render', async () => {
await page.goto(`${base}/no-error`);
await start();