Skip to content

Commit

Permalink
fix more
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich-Harris committed Dec 13, 2023
1 parent b24e8eb commit d31afbb
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions packages/kit/test/apps/basics/src/hooks.client.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { env } from '$env/dynamic/public';
window.PUBLIC_DYNAMIC = env.PUBLIC_DYNAMIC;

/** @type{import("@sveltejs/kit").HandleClientError} */
export function handleError({ error, event }) {
export function handleError({ error, event, status, message }) {
return event.url.pathname.endsWith('404-fallback')
? undefined
: { message: /** @type {Error} */ (error).message };
: { message: `${/** @type {Error} */ (error).message} (${status} ${message})` };
}
2 changes: 1 addition & 1 deletion packages/kit/test/apps/basics/test/client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ test.describe('Load', () => {
test('accessing url.hash from load errors and suggests using page store', async ({ page }) => {
await page.goto('/load/url-hash#please-dont-send-me-to-load');
expect(await page.textContent('#message')).toBe(
'This is your custom error page saying: "Cannot access event.url.hash. Consider using `$page.url.hash` inside a component instead"'
'This is your custom error page saying: "Cannot access event.url.hash. Consider using `$page.url.hash` inside a component instea (500 Internal Error)"'
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ test.describe.serial('Errors', () => {

expect(await page.textContent('footer')).toBe('Custom layout');
expect(await page.textContent('#message')).toBe(
'This is your custom error page saying: "Crashing now"'
'This is your custom error page saying: "Crashing now (500 Internal Error)"'
);
});

Expand Down
2 changes: 1 addition & 1 deletion packages/kit/test/apps/basics/test/cross-platform/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ test.describe('Redirects', () => {
expect(page.url()).toBe(`${baseURL}/redirect/loopy/a`);
expect(await page.textContent('h1')).toBe('500');
expect(await page.textContent('#message')).toBe(
'This is your custom error page saying: "Redirect loop"'
'This is your custom error page saying: "Redirect loop (500 Internal Error)"'
);
} else {
// there's not a lot we can do to handle server-side redirect loops
Expand Down

0 comments on commit d31afbb

Please sign in to comment.