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

fix: Wrap HEAD request in a try-catch to prevent watch mode crashes on server reloads #1748

Merged
merged 2 commits into from
Feb 26, 2025

Conversation

Matsuuu
Copy link
Contributor

@Matsuuu Matsuuu commented Feb 26, 2025

A quick fix on the problem discussed at #1542 (comment)

I'm not sure if this is the best approach, but I didn't want to go fiddling around with the json-schema-ref-parser library, which is causing the actual error to pop up so I wrote this and tested it out and it seemed to run without a hitch.

I also decided to pass the exception message to the response body but idk if that's what we want to do here.

Tested locally against the repro I posted here and another project and couldn't get it to crash.

Copy link

stackblitz bot commented Feb 26, 2025

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Copy link

changeset-bot bot commented Feb 26, 2025

🦋 Changeset detected

Latest commit: 7326d25

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@hey-api/openapi-ts Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Feb 26, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
hey-api-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 26, 2025 9:22pm

Copy link

codecov bot commented Feb 26, 2025

Codecov Report

Attention: Patch coverage is 0% with 16 lines in your changes missing coverage. Please review.

Project coverage is 57.14%. Comparing base (c319ba3) to head (7326d25).
Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
packages/openapi-ts/src/getSpec.ts 0.00% 16 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1748      +/-   ##
==========================================
- Coverage   57.15%   57.14%   -0.02%     
==========================================
  Files         191      191              
  Lines       25720    25728       +8     
  Branches     1913     1913              
==========================================
  Hits        14701    14701              
- Misses      11010    11018       +8     
  Partials        9        9              
Flag Coverage Δ
unittests 57.14% <0.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

pkg-pr-new bot commented Feb 26, 2025

Open in Stackblitz

@hey-api/client-axios

npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/client-axios@1748

@hey-api/client-fetch

npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/client-fetch@1748

@hey-api/client-next

npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/client-next@1748

@hey-api/client-nuxt

npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/client-nuxt@1748

@hey-api/openapi-ts

npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/openapi-ts@1748

commit: 7326d25

@mrlubos mrlubos merged commit 9cbbc61 into hey-api:main Feb 26, 2025
15 of 17 checks passed
@github-actions github-actions bot mentioned this pull request Feb 26, 2025
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