Repository navigation
fix(core): honor abortOnError passed to select() - #18210
Merged
Merged
Conversation
- Read abortOnError from the select() options in the exception proxy and wrap the selected context with that value, so its get() and further select() calls exit or throw as requested. - Leave the call and its result unchanged when select() gets no abortOnError. - Cover both directions, a failing select(), nested selects and the default in an e2e spec.
4 of 12 tasks
ttt43ttt
pushed a commit
to NoDevelopers/ts-monorepo
that referenced
this pull request
Nov 22, 2026
| datasource | package | from | to | | ---------- | ------------------------ | ------ | ------ | | npm | @nestjs/common | 12.2.0 | 12.3.1 | | npm | @nestjs/core | 12.2.0 | 12.3.1 | | npm | @nestjs/platform-express | 12.2.0 | 12.3.1 | ## [v12.3.1](nestjs/nest@v12.3.0...v12.3.1) ## [v12.3.0](https://github.com/nestjs/nest/releases/tag/v12.3.0) #### v12.3.0 (2026-10-27) ##### Features - `platform-node` - [#18063](nestjs/nest#18063) feat(node): add a native node http platform adapter ([@kamilmysliwiec](https://github.com/kamilmysliwiec)) ##### Bug fixes - `common` - [#18289](nestjs/nest#18289) fix(common): report the detected file type in file type errors ([@DenisCDev](https://github.com/DenisCDev)) - [#18246](nestjs/nest#18246) fix(common): avoid throwing for arrow prototype constructors ([@fengxueweilai](https://github.com/fengxueweilai)) - [#18220](nestjs/nest#18220) fix(common): abort the response when a streamable file fails midway ([@thekhegay](https://github.com/thekhegay)) - `core` - [#18276](nestjs/nest#18276) fix(core): run middleware once for routes that differ only in version ([@OmBhandwaldar](https://github.com/OmBhandwaldar)) - [#18262](nestjs/nest#18262) fix(core): tolerate sse request sockets without tuning methods ([@SnowingFox](https://github.com/SnowingFox)) - [#18252](nestjs/nest#18252) fix(core): read the url protocol from the server ([@thekhegay](https://github.com/thekhegay)) - [#18254](nestjs/nest#18254) fix(core): name the array and index of undefined module entries ([@thekhegay](https://github.com/thekhegay)) - [#18235](nestjs/nest#18235) fix(core): discover classes by each of their discovery decorators ([@OmBhandwaldar](https://github.com/OmBhandwaldar)) - [#18216](nestjs/nest#18216) fix(core): read the abort on error option of the app being called ([@thekhegay](https://github.com/thekhegay)) - [#18209](nestjs/nest#18209) fix(core): let middleware exclusions cover prefix-excluded routes ([@thekhegay](https://github.com/thekhegay)) - [#18210](nestjs/nest#18210) fix(core): honor abortOnError passed to select() ([@Cayan](https://github.com/Cayan)) - [#18215](nestjs/nest#18215) fix(core): subscribe to handler observables from other rxjs copies ([@koreahghg](https://github.com/koreahghg)) - [#18201](nestjs/nest#18201) fix(core): read a quoted media type version in the middleware exclusions ([@hktitof](https://github.com/hktitof)) - [#18200](nestjs/nest#18200) fix(core): resolve request-scoped forward refs for concurrent requests ([@maxymlyskov](https://github.com/maxymlyskov)) - `common`, `microservices`, `platform-ws` - [#18285](nestjs/nest#18285) fix(ws,microservices): load packages where bundlers can see them ([@kamilmysliwiec](https://github.com/kamilmysliwiec)) - `common`, `microservices`, `websockets` - [#18272](nestjs/nest#18272) fix(common): keep one route param per argument in an overriding method ([@maxymlyskov](https://github.com/maxymlyskov)) - `platform-express` - [#18264](nestjs/nest#18264) fix(express): map unsupported multipart content types to 415 ([@seren-wib](https://github.com/seren-wib)) - [#18234](nestjs/nest#18234) fix(express): end a head response for an empty streamable file ([@spokodev](https://github.com/spokodev)) - [#18232](nestjs/nest#18232) fix(express): leave 5xx http-errors errors unmapped so they are logged ([@kamilmysliwiec](https://github.com/kamilmysliwiec)) - [#18214](nestjs/nest#18214) fix(platform-express): map http-errors exceptions to HttpException in Express adapter ([@okxint](https://github.com/okxint)) - [#18199](nestjs/nest#18199) fix(express): send the standard body for an exception wrapping an error ([@KAPUIST](https://github.com/KAPUIST)) - `platform-fastify` - [#18253](nestjs/nest#18253) fix(fastify): send object error bodies with a json content type ([@maxymlyskov](https://github.com/maxymlyskov)) - [#18240](nestjs/nest#18240) fix(fastify): leave 5xx fastify errors unmapped so they are logged ([@thekhegay](https://github.com/thekhegay)) - [#18239](nestjs/nest#18239) fix(fastify): map 4xx http-errors errors to http exceptions ([@kamilmysliwiec](https://github.com/kamilmysliwiec)) - [#18226](nestjs/nest#18226) fix(fastify): listen on a file descriptor ([@thekhegay](https://github.com/thekhegay)) - [#18217](nestjs/nest#18217) fix(fastify): run cors before nest middleware ([@kamilmysliwiec](https://github.com/kamilmysliwiec)) - `core`, `platform-express`, `platform-fastify`, `platform-socket.io`, `platform-ws`, `websockets` - [#18251](nestjs/nest#18251) fix(core,express,fastify,ws,socket.io): load adapters with an older core ([@thekhegay](https://github.com/thekhegay)) - `microservices` - [#18250](nestjs/nest#18250) fix(microservices): re-arm the redis retries on a new listen ([@hktitof](https://github.com/hktitof)) - [#18255](nestjs/nest#18255) fix(microservices): report a nats connection that gave up reconnecting ([@thekhegay](https://github.com/thekhegay)) - [#18249](nestjs/nest#18249) fix(microservices): do not emit a trailing null to kafka requesters ([@thekhegay](https://github.com/thekhegay)) - [#18256](nestjs/nest#18256) fix(microservices): let a retriable exception keep travelling ([@hktitof](https://github.com/hktitof)) - [#18238](nestjs/nest#18238) fix(microservices): retry the tcp server again after close and listen ([@kamilmysliwiec](https://github.com/kamilmysliwiec)) - [#18223](nestjs/nest#18223) fix(microservices): clear the tcp retry timer when a new listen starts ([@hktitof](https://github.com/hktitof)) - [#18221](nestjs/nest#18221) fix(microservices): honor mqtt topic filter boundaries ([@fabric0de](https://github.com/fabric0de)) - [#18229](nestjs/nest#18229) fix(microservices): let only the exact message handler answer a request ([@maxymlyskov](https://github.com/maxymlyskov)) - [#18211](nestjs/nest#18211) fix(microservices): fail the request when its last reply cannot be sent ([@maxymlyskov](https://github.com/maxymlyskov)) - [#18206](nestjs/nest#18206) fix(microservices): reset the tcp retry attempts on each listen ([@hktitof](https://github.com/hktitof)) - [#18204](nestjs/nest#18204) fix(microservices): count every failed rmq connection attempt ([@maxymlyskov](https://github.com/maxymlyskov)) - [#18197](nestjs/nest#18197) fix(microservices): send the record headers of nats as message headers ([@hktitof](https://github.com/hktitof)) ##### Dependencies - `platform-express` - [#18268](nestjs/nest#18268) fix(deps): update dependency multer to v2.5.0 \[security] ([@renovate\[bot\]](https://github.com/apps/renovate)) - `common` - [#18257](nestjs/nest#18257) fix(deps): update dependency file-type to v22.2.0 ([@kamilmysliwiec](https://github.com/kamilmysliwiec)) - `platform-fastify` - [#18219](nestjs/nest#18219) fix(deps): update dependency [@fastify/middie](https://github.com/fastify/middie) to v9.3.6 ([@renovate\[bot\]](https://github.com/apps/renovate)) ##### Committers: 16 - Abdellatif Anaflous ([@hktitof](https://github.com/hktitof)) - Daniel Pinto ([@Cayan](https://github.com/Cayan)) - Denis Scarabelli ([@DenisCDev](https://github.com/DenisCDev)) - Junpei Zhang ([@pei711](https://github.com/pei711)) - Kamil Mysliwiec ([@kamilmysliwiec](https://github.com/kamilmysliwiec)) - Luke Son ([@KAPUIST](https://github.com/KAPUIST)) - Maksym Lyskov ([@maxymlyskov](https://github.com/maxymlyskov)) - Om Bhandwaldar ([@OmBhandwaldar](https://github.com/OmBhandwaldar)) - Roman Khegay ([@thekhegay](https://github.com/thekhegay)) - Spoko Dev ([@spokodev](https://github.com/spokodev)) - [@fengxueweilai](https://github.com/fengxueweilai) - [@okxint](https://github.com/okxint) - snowingfox ([@SnowingFox](https://github.com/SnowingFox)) - yooseong ([@seren-wib](https://github.com/seren-wib)) - 김정현 (Kim JungHyeon) ([@fabric0de](https://github.com/fabric0de)) - 한국 ([@koreahghg](https://github.com/koreahghg))
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: follow-up to #14113 (feature request #13735)
#14113 added
SelectOptions.abortOnErrorso thatapp.select(Module, { abortOnError: false })logs and throws instead of exiting when the module is not part of the application.NestApplicationContext.select()stores the option on the selected context, but nothing reads it there. Error handling is decided by the proxyNestFactoryputs around the application, and that proxy only looks at theabortOnErrorthe application was created with.So with an application created with the default options,
app.select(NotImportedModule, { abortOnError: false })still logs theUnknownModuleExceptionand callsprocess.exit(1). In the other direction, with an application created withabortOnError: false,app.select(FeatureModule, { abortOnError: true }).get('missing')throws instead of exiting, because the selected context is returned without the proxy.What is the new behavior?
The exception proxy reads
abortOnErrorfrom theselect()options. When it is set, theselect()call itself uses it, and the returned context is wrapped in the same proxy with that value, so its synchronous methods (get, a furtherselect) follow it too. When the option is not passed, nothing changes: the call uses the application's setting and the selected context is returned as before.The change covers applications from
NestFactory.createandNestFactory.createMicroservice, which are the onesNestFactorywraps in this proxy. A standalone context fromNestFactory.createApplicationContextis returned without the proxy, so neither the application-level nor theselect()-levelabortOnErrorapplies there; that is unchanged and out of scope here.The change is in
createProxy,createExceptionProxyandcreateExceptionZoneinpackages/core/nest-factory.ts.Does this PR introduce a breaking change?
Other information
integration/hello-world/e2e/select-abort-on-error.spec.tsstubsprocess.exitand runs on applications fromNestFactory.create. It covers both directions, a failingselect()withabortOnError: true(exits instead of throwing, and the proxy is not applied to the missing result), a furtherselect()on a selected context that set the option, a furtherselect()that overrides it, and aselect()without the option on a default application, which must still throwUnknownElementExceptionfromget('missing')without exiting. The first four tests fail on master. The last two pass there: they guard the override and the unchanged default. Each part of the fix was also changed on its own (ignoring theselect()option, not wrapping the selected context, wrapping a missing result, wrapping it with the application's setting, wrapping only when the call itself passed the option, always wrapping, letting the inherited value win over the call's option) and at least one test failed every time.npx vitest run packages/core(1629 tests) and thehello-worldandinjectorintegration suites (387 passed, 1 skipped) pass.Code that already passes
abortOnErrortoselect()now gets the documented behaviour. WithabortOnError: true, a failing call on the selected context, such asget('missing'), exits the process where it used to throw, on applications created with the default options as well as withabortOnError: false. WithabortOnError: false, the error is logged and thrown instead of exiting. Code that does not pass the option is unchanged, so I left the breaking change box unchecked.