From 6c4e153dde2b41f8c6bb719568314a0278e668c9 Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Sun, 14 Mar 2021 16:45:46 -0700 Subject: [PATCH] Fix two more type errors (#527) --- packages/kit/src/runtime/client/renderer.js | 4 ++-- packages/kit/src/runtime/server/page.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/kit/src/runtime/client/renderer.js b/packages/kit/src/runtime/client/renderer.js index 6e25d000f966..d8363b7a8403 100644 --- a/packages/kit/src/runtime/client/renderer.js +++ b/packages/kit/src/runtime/client/renderer.js @@ -168,7 +168,7 @@ export class Renderer { /** * @param {import('./types').NavigationTarget} selected - * @param {string[]} chain + * @param {string[]} [chain] */ async render(selected, chain) { const token = (this.token = {}); @@ -182,7 +182,7 @@ export class Renderer { hydrated.props.error = new Error('Redirect loop'); } else { this.router.goto(hydrated.redirect, { replaceState: true }, [ - ...chain, + ...(chain || []), this.current.page.path ]); diff --git a/packages/kit/src/runtime/server/page.js b/packages/kit/src/runtime/server/page.js index 8a2229df431a..c29e14c53e74 100644 --- a/packages/kit/src/runtime/server/page.js +++ b/packages/kit/src/runtime/server/page.js @@ -187,7 +187,7 @@ async function get_response({ request, options, $session, route, status = 200, e // error page, there's not a lot we can do if (error) throw e instanceof Error ? e : new Error(e); - loaded = { error: e instanceof Error ? e : { message: e.toString() }, status: 500 }; + loaded = { error: e instanceof Error ? e : { name: 'Error', message: e.toString() }, status: 500 }; } if (loaded) { @@ -276,7 +276,7 @@ async function get_response({ request, options, $session, route, status = 200, e $session, route, status: 500, - error: e instanceof Error ? e : { message: e.toString() } + error: e instanceof Error ? e : { name: 'Error', message: e.toString() } }); }