Repository navigation
fix(blaze): report a rejected attribute promise once - #534
Merged
jankapunkt merged 2 commits intoNov 11, 2026
Merged
jankapunkt merged 2 commits into
jankapunkt merged 2 commits into
Conversation
A promise that rejects in an attribute was reported by every layer of the attribute promise chain in materializer.js: where it rejected, again by the Promise.all of its attribute set, and again by the final then() of the attribute updater. One failing attribute produced three reports, two produced five, and tools that hook Meteor._debug counted each of them as a separate error. Only the place where the promise rejects reports it now. The enclosing Promise.all lets the rejection through, and the final then() only keeps it from going unhandled. Each failing attribute is still reported, once. The then() helper of materializer.js has no other caller.
jankapunkt
approved these changes
Nov 11, 2026
…butes An error thrown while reading the attributes a promise resolved to, for example by a getter on the object, rejects the chain from inside the fulfillment callback of `waitForAllAttributes`, so none of its reporting handlers sees it. The last `then()` was the only place that reported it, and the previous commit silenced that `then()`. Rethrow the rejections that `waitForAllAttributes` reports as a marker, and let the last `then()` report every other error, so a rejected promise is still reported once, where it rejects, and an error thrown while reading the resolved attributes is reported once at the end.
jankapunkt
approved these changes
Nov 11, 2026
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.
Summary
A promise that rejects in an attribute is reported several times. With
the console shows
Exception caught in template: Error: boomthree times, and a hook onMeteor._debug(Monti APM, for example) records three errors. Every layer of the attribute promise chain inmaterializer.jsreports and rethrows: the attribute value itself (value.then(..., Blaze._reportExceptionAndThrow)), thePromise.all(...)of the attribute set inwaitForAllAttributes, then the finalthen(..., Blaze._reportException)of the attribute updater inmaterializeTag. Two failing attributes on the same element give five reports, three for the first and two for the second.The code involved is already on
master, so this is not a 3.1 regression.Change
Only the place where the promise rejects reports it:
Promise.all(...)ofwaitForAllAttributeslets the rejection through instead of reporting it again;then()reports every error that is not that marker, so an error thrown while reading the resolved attributes, for example by a getter on the object a promise resolved to, is still reported once at the end, as before.The
then()helper ofmaterializer.jshas no other caller.Verification
spacebars-tests/async_tests.js, on the existingattribute,attributesandattributes_doubletemplates: a rejected value, a rejected attributes object, a rejected value nested in an attributes object, and two rejected values on the same element. They captureBlaze._reportExceptionand expect one report per rejected promise. On the current code they get three, two, three, and five instead of two.getteronce with the second.test-app(Meteor 3.4, same as CI): native DOM backend 425/425, jQuery backend 429/429. No unhandled rejection in the logs.AGENTS.md.Changelog
Suggested line for
HISTORY.mdonce the next version heading exists: