Skip to content

fix(sveltekit): Avoid capturing 404 errors on client side #9902

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 19, 2023

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Dec 18, 2023

I belive, these errors weren't passed to the client side handleError hook in Kit 1.x but in 2.x they're now passed into the hook. This means, we need to filter them out.

Added the same logic for the client side as in #9901

ref #9851

@Lms24 Lms24 changed the base branch from develop to lms/ref-sveltekit-improve-server-handleError December 18, 2023 18:07
@Lms24 Lms24 requested review from AbhiPrasad and lforst December 18, 2023 18:09
@Lms24 Lms24 marked this pull request as ready for review December 18, 2023 18:09
@Lms24 Lms24 mentioned this pull request Dec 18, 2023
@Lms24 Lms24 self-assigned this Dec 18, 2023
});
return (input: SafeHandleServerErrorInput): ReturnType<HandleClientError> => {
const { status, message } = input;
const isNotFoundError = status === 404 && message === 'Not Found';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

l: might make sense to extract this into function to use between client/server in case this logic needs to change in the future.

Copy link
Member Author

@Lms24 Lms24 Dec 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would have agreed but now that I simplified the check here and in #9901, I think it's no longer worth to extract checking for a 404 status.

@Lms24 Lms24 force-pushed the lms/ref-sveltekit-improve-server-handleError branch from a4e6a66 to 51788bc Compare December 19, 2023 12:18
@Lms24 Lms24 force-pushed the lms/fix-sveltekit-filter-client-not-found branch from 212846c to b3e504a Compare December 19, 2023 12:30
Base automatically changed from lms/ref-sveltekit-improve-server-handleError to develop December 19, 2023 12:35
@Lms24 Lms24 force-pushed the lms/fix-sveltekit-filter-client-not-found branch from b3e504a to 8e8fc17 Compare December 19, 2023 12:40
@Lms24 Lms24 changed the title fix(sveltekit): Avoid capturing "Not Found" errors on client side fix(sveltekit): Avoid capturing 404 errors on client side Dec 19, 2023
@Lms24 Lms24 enabled auto-merge (squash) December 19, 2023 12:41
@Lms24 Lms24 merged commit cf773fc into develop Dec 19, 2023
@Lms24 Lms24 deleted the lms/fix-sveltekit-filter-client-not-found branch December 19, 2023 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants