Skip to content

Added http-status-ts enum error codes - #42

Merged
AlexKempen merged 6 commits into
certfrom
Add-http-error-enum-lib
Aug 16, 2026
Merged

Added http-status-ts enum error codes#42
AlexKempen merged 6 commits into
certfrom
Add-http-error-enum-lib

Conversation

@Decentro08

@Decentro08 Decentro08 commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Added the npm package, http-status-ts, to use its error code enum for backend handling on various routes.

  • Replaced hard-coded error codes, such as 404, in backend classes.
  • Updated zod-validator package to v0.9.0
  • Added http-status-ts v2.0.1 to packages
  • Vitest maxWorkers set to 1 due to parallel instances failing while running npm test

@Decentro08 Decentro08 self-assigned this Aug 13, 2026
@Decentro08 Decentro08 linked an issue Aug 13, 2026 that may be closed by this pull request
claude added 2 commits August 16, 2026 17:14
The hand-merge that brought this branch up to date pulled in two changes
unrelated to the status-code work:

- `maxWorkers: 1` on the backend vitest project. The suite passes without
  it (190/190) and runs in 34s instead of 58s. Storage isolation is
  per-test-file and `applyD1Migrations` is idempotent, so parallel workers
  are already safe by design.
- The `/toggle-open-composite` route, which #40 deleted when the flag
  became something load computes. Nothing calls it, and writing the flag
  by hand would just be overwritten on the next load.

Also convert the call sites the sweep missed: `getLibraryParam`, the
onError rate-limit and fallback responses, `OnshapeRateLimitError`, and
the 429 check in `OnshapeApi`. Test assertions keep their literals so
they still pin the wire values independently. Moves the http-status-ts
import in onshape-api.ts up with the other imports.
cert advanced past this branch's base with the cache-policy work, which
restructured the four files the status-code sweep had touched. Resolved by
taking cert's version of each and re-applying only the enum conversion, so
the caching behavior comes through unchanged:

- create-app.ts: cert's rewrite (getEntryUrl, isAuthenticated service,
  cacheMiddleware on /auth and /init); re-converted the onError 429/500.
- configurations.ts, library.ts, thumbnails.ts: cert's cacheMiddleware
  wrapping kept as-is; re-converted the 400/404s in the new route bodies.

Also converts the one new bare literal cert introduced, the "Missing cache
version" 400 in cacheMiddleware, which auto-merged into app.ts.

Kept this branch's package-lock.json: the merged package.json adds only
http-status-ts and the zod-validator bump, cert added no dependencies, and
cert's lockfile does not satisfy the 0.9.0 range. Its resolutions are ahead
of cert's on 43 transitive packages and no package is missing.

@AlexKempen AlexKempen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good, Claude found two or three extra places and I removed the max parallel limiter since I don't think that's an actual issue, but no big issue. Thanks for the PR!

@AlexKempen
AlexKempen merged commit 4048f22 into cert Aug 16, 2026
1 check passed
@AlexKempen
AlexKempen deleted the Add-http-error-enum-lib branch August 21, 2026 02:46
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.

Add http error enum library

3 participants