Skip to content
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

sveltekit error handling #705

Merged
merged 16 commits into from
Sep 25, 2024
Merged

sveltekit error handling #705

merged 16 commits into from
Sep 25, 2024

Conversation

eyeseast
Copy link
Collaborator

#502

This wraps API responses in a new type and abstracts handling responses from the API. It uses typescript generics to pass through the types we need, for both data and errors.

Copy link

github-actions bot commented Sep 24, 2024

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 23.19% 6305 / 27183
🔵 Statements 23.19% 6305 / 27183
🔵 Functions 40.18% 133 / 331
🔵 Branches 57.58% 334 / 580
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
src/lib/api/addons.ts 66.93% 94.73% 54.54% 66.93% 71-80, 85-102, 107-119, 126-145, 150-169
src/lib/api/collaborators.ts 100% 100% 100% 100%
src/lib/api/documents.ts 97.88% 88.67% 100% 97.88% 130-131, 148-154, 158-159, 458-460
src/lib/api/flatpages.ts 0% 0% 0% 0% 1-15
src/lib/api/notes.ts 85.78% 78.57% 83.33% 85.78% 25-37, 43-58
src/lib/api/projects.ts 90.84% 100% 92.3% 90.84% 253-278
src/lib/api/sections.ts 70.66% 100% 60% 70.66% 17-36, 44-67
src/lib/api/types.d.ts 0% 0% 0% 0% 1-293
src/lib/components/forms/DocumentUpload.svelte 100% 25% 0% 100%
src/lib/components/forms/EditNote.svelte 0% 0% 0% 0% 1-107
src/lib/components/forms/EditSectionRow.svelte 0% 0% 0% 0% 1-175
src/lib/components/forms/Reprocess.svelte 0% 0% 0% 0% 1-178
src/lib/components/layouts/AddOnBrowser.svelte 0% 0% 0% 0% 1-174
src/lib/components/layouts/DocumentBrowser.svelte 0% 0% 0% 0% 1-2327
src/lib/components/projects/ProjectPin.svelte 0% 0% 0% 0% 1-55
src/lib/utils/api.ts 95.62% 85.18% 100% 95.62% 93-96, 117-118
src/routes/(app)/add-ons/+page.svelte 0% 0% 0% 0% 1-26
src/routes/(app)/add-ons/[owner]/[repo]/+page.server.ts 0% 0% 0% 0% 1-35
src/routes/(app)/add-ons/[owner]/[repo]/+page.ts 0% 0% 0% 0% 1
src/routes/(app)/add-ons/[owner]/[repo]/[event]/+page.server.ts 0% 0% 0% 0% 1-40
src/routes/(app)/add-ons/[owner]/[repo]/[event]/+page.ts 0% 0% 0% 0% 1
src/routes/(app)/documents/+layout.ts 0% 0% 0% 0% 1
src/routes/(app)/documents/+page.server.ts 0% 0% 0% 0% 1
src/routes/(app)/documents/+page.svelte 0% 0% 0% 0% 1-68
src/routes/(app)/documents/+page.ts 0% 0% 0% 0% 1
src/routes/(app)/documents/[id]-[slug]/+layout.ts 0% 0% 0% 0% 1
src/routes/(app)/documents/[id]-[slug]/+page.server.ts 0% 0% 0% 0% 1
src/routes/(app)/documents/projects/+page.ts 0% 0% 0% 0% 1
src/routes/(app)/documents/projects/[id]-[slug]/+page.server.ts 0% 0% 0% 0% 1-104
src/routes/(app)/documents/projects/[id]-[slug]/+page.ts 0% 0% 0% 0% 1
src/routes/(app)/upload/+page.ts 0% 0% 0% 0% 1
src/routes/embed/documents/[id]-[slug]/+layout.ts 0% 0% 0% 0% 1
src/routes/embed/documents/[id]/annotations/[note_id]/+page.ts 0% 0% 0% 0% 1
src/routes/embed/documents/[id]/pages/[page]/+page.ts 0% 0% 0% 0% 1
src/routes/embed/projects/[project_id]/+page.ts 0% 0% 0% 0% 1
Generated in workflow #474

Copy link

netlify bot commented Sep 24, 2024

Deploy Preview for documentcloud-frontend ready!

Name Link
🔨 Latest commit f6993cf
🔍 Latest deploy log https://app.netlify.com/sites/documentcloud-frontend/deploys/66f4287074b58c00082b2388
😎 Deploy Preview https://deploy-preview-705.muckcloud.com
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@allanlasser allanlasser left a comment

Choose a reason for hiding this comment

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

Some initial guidance on generic types before you go further on retyping API calls. Overall makes a ton of sense.

src/lib/api/types.d.ts Outdated Show resolved Hide resolved
src/lib/utils/api.ts Outdated Show resolved Hide resolved
src/lib/api/types.d.ts Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
src/lib/components/layouts/DocumentBrowser.svelte Outdated Show resolved Hide resolved
src/lib/utils/api.ts Outdated Show resolved Hide resolved
@eyeseast eyeseast marked this pull request as ready for review September 25, 2024 01:43
Copy link
Member

@allanlasser allanlasser left a comment

Choose a reason for hiding this comment

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

Caught one minor issue. And a question: are +error.svelte pages coming later?

src/routes/(app)/add-ons/+page.svelte Show resolved Hide resolved
@allanlasser allanlasser merged commit 12067bc into sveltekit Sep 25, 2024
9 of 10 checks passed
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