diff --git a/src/core/create_routes.ts b/src/core/create_routes.ts index 4515076..0b6c3e8 100644 --- a/src/core/create_routes.ts +++ b/src/core/create_routes.ts @@ -11,6 +11,10 @@ export default function create_routes({ files } = { files: glob.sync('**/*.*', { throw new Error(`Invalid route ${file} — parameters must be separated`); } + if (file === '4xx.html' || file === '5xx.html') { + throw new Error('As of Sapper 0.14, 4xx.html and 5xx.html should be replaced with _error.html'); + } + const base = file.replace(/\.[^/.]+$/, ''); const parts = base.split('/'); // glob output is always posix-style if (parts[parts.length - 1] === 'index') parts.pop(); diff --git a/test/unit/create_routes.test.js b/test/unit/create_routes.test.js index f299464..95eb116 100644 --- a/test/unit/create_routes.test.js +++ b/test/unit/create_routes.test.js @@ -280,4 +280,20 @@ describe('create_routes', () => { }); }, /Invalid route \[foo\]\[bar\]\.js — parameters must be separated/); }); + + it('errors on 4xx.html', () => { + assert.throws(() => { + create_routes({ + files: ['4xx.html'] + }); + }, /As of Sapper 0.14, 4xx.html and 5xx.html should be replaced with _error.html/); + }); + + it('errors on 5xx.html', () => { + assert.throws(() => { + create_routes({ + files: ['5xx.html'] + }); + }, /As of Sapper 0.14, 4xx.html and 5xx.html should be replaced with _error.html/); + }); }); \ No newline at end of file