Skip to content

fix(common): Add missing exception classes to HttpErrorByCode#17257

Open
Se3do wants to merge 1 commit into
nestjs:masterfrom
Se3do:fix/http-error-by-code-missing-exceptions
Open

fix(common): Add missing exception classes to HttpErrorByCode#17257
Se3do wants to merge 1 commit into
nestjs:masterfrom
Se3do:fix/http-error-by-code-missing-exceptions

Conversation

@Se3do

@Se3do Se3do commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

HttpErrorByCode map in packages/common/utils/http-error-by-code.util.ts is missing MisdirectedException (421) and HttpVersionNotSupportedException (505). Both classes exist on disk and are exported from packages/common/exceptions/index.ts, but are absent from the ErrorHttpStatusCode type union and the HttpErrorByCode Record. Using errorHttpStatusCode: HttpStatus.MISDIRECTED in pipe options causes a TypeScript type error, and HttpErrorByCode[HttpStatus.MISDIRECTED] returns undefined at runtime.

Issue Number: N/A

What is the new behavior?

Both MisdirectedException and HttpVersionNotSupportedException are now imported, added to the ErrorHttpStatusCode type union, and mapped in the HttpErrorByCode Record — consistent with the 19 other exception classes already present. Added 5 unit tests verifying all 21 entries resolve to valid HttpException subclasses with correct status codes.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

HttpErrorByCode map was missing MisdirectedException (421) and HttpVersionNotSupportedException (505) that already existed on disk.

Added imports, type union entries, and map entries. Added test file verifying all entries resolve to valid HttpException subclasses.
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.

1 participant