mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-11 19:04:30 +00:00
handle unknown preload errors
This commit is contained in:
@@ -299,13 +299,10 @@ function get_page_handler(
|
||||
parts: [
|
||||
{ name: null, component: error_route }
|
||||
]
|
||||
}, req, res, statusCode, error);
|
||||
}, req, res, statusCode, error || new Error('Unknown error in preload function'));
|
||||
}
|
||||
|
||||
function handle_page(page: Page, req: Req, res: ServerResponse, status = 200, error: Error | string = null) {
|
||||
const get_params = page.parts[page.parts.length - 1].params || (() => ({}));
|
||||
const match = error ? null : page.pattern.exec(req.path);
|
||||
|
||||
const chunks: Record<string, string | string[]> = get_chunks();
|
||||
|
||||
res.setHeader('Content-Type', 'text/html');
|
||||
@@ -391,6 +388,8 @@ function get_page_handler(
|
||||
})
|
||||
: {};
|
||||
|
||||
const match = error ? null : page.pattern.exec(req.path);
|
||||
|
||||
Promise.all([root_preloaded].concat(page.parts.map(part => {
|
||||
if (!part) return null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user