Skip to content

Conversation

@TheCodby
Copy link
Contributor

@TheCodby TheCodby commented Nov 21, 2025

apply default description ("I'm a teapot") when HttpExceptionOptions are provided without an explicit description. previously, passing only an options object such as { cause } resulted in description being undefined because extractDescriptionAndOptionsFrom() does not apply any fallback. this change restores consistent behavior with other built-in HTTP exceptions, which all preserve their default descriptions when options are provided without a description.

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?

Issue Number: #15961

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

apply default description ("I'm a teapot") when HttpExceptionOptions are provided without an explicit description. previously, passing only an options object such as { cause } resulted in description being undefined because extractDescriptionAndOptionsFrom() does not apply any fallback. this change restores consistent behavior with other built-in HTTP exceptions, which all preserve their default descriptions when options are provided without a description.

Closes nestjs#15961
@coveralls
Copy link

Pull Request Test Coverage Report for Build 93b73477-6464-42f0-9045-630caa928193

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 88.939%

Totals Coverage Status
Change from base Build 16a7a9db-da31-4e44-b9ef-ee5b8f08bc3e: 0.0%
Covered Lines: 7325
Relevant Lines: 8236

💛 - Coveralls

@karlismelderis-mckinsey

Love the PR but there are so many more exceptions:
https://github.com/nestjs/nest/tree/master/packages/common/exceptions

malkovitc pushed a commit to malkovitc/nest that referenced this pull request Dec 2, 2025
…n using options

When providing HttpExceptionOptions (e.g., { cause }) without an explicit
description, the default description was lost because extractDescriptionAndOptionsFrom()
returns undefined for the description property.

This fix applies the same pattern used in PR nestjs#15962 for ImATeapotException to all
built-in HTTP exceptions: using destructuring default values to preserve the
default description when options are provided without an explicit description.

Closes nestjs#15961
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.

3 participants