Skip to content

feat: add Blaze.setExceptionLogLevel() to configure exception log level#509

Open
nicolv wants to merge 10 commits into
meteor:release-3.1.0from
nicolv:feat/exception-log-level
Open

feat: add Blaze.setExceptionLogLevel() to configure exception log level#509
nicolv wants to merge 10 commits into
meteor:release-3.1.0from
nicolv:feat/exception-log-level

Conversation

@nicolv
Copy link
Copy Markdown

@nicolv nicolv commented Apr 28, 2026

What

Adds a new Blaze.setExceptionLogLevel(level) method that lets apps configure which console method is used when Blaze reports template exceptions.

Why

Fixes #314 — currently all template exceptions are reported via console.log, which means they don't show up in error trackers that only capture console.error (like Sentry). There's also no way to make the app fail-fast on template errors since exceptions are always logged as info level.

How

The default remains console.log to avoid breaking existing apps (as discussed in the issue). Apps that want exceptions in the error console can now call:

Blaze.setExceptionLogLevel('error');

Allowed levels: 'log', 'warn', 'error'.

The change is fully backward compatible — existing behavior is unchanged unless you opt in.

Testing

Existing tests should continue to pass. The default behavior is unchanged.

dependabot Bot and others added 10 commits April 3, 2026 15:36
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.21 to 4.18.1.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](lodash/lodash@4.17.21...4.18.1)

---
updated-dependencies:
- dependency-name: lodash
  dependency-version: 4.18.1
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.1.2 to 3.1.5.
- [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md)
- [Commits](isaacs/minimatch@v3.1.2...v3.1.5)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-version: 3.1.5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.14.1 to 3.14.2.
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](nodeca/js-yaml@3.14.1...3.14.2)

---
updated-dependencies:
- dependency-name: js-yaml
  dependency-version: 3.14.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jan Küster <jkuester@uni-bremen.de>
Closes meteor#314

Template exceptions currently always use console.log, which causes two
problems:
1. They don't appear in Sentry and other error trackers that only
   capture console.error/warn output
2. Developers can't fail-fast on template errors since there's no way
   to elevate them to error level

This change is fully backward compatible — the default remains console.log.
Users can now call Blaze.setExceptionLogLevel('error') to route exceptions
to console.error, or 'warn' for console.warn.

Usage:
  Blaze.setExceptionLogLevel('error');  // exceptions appear in error console

Allowed levels: 'log', 'warn', 'error'
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 28, 2026

CLA assistant check
All committers have signed the CLA.

@jankapunkt
Copy link
Copy Markdown
Collaborator

jankapunkt commented Apr 28, 2026

Thank you @nicolv for your contribution! Please review #495 and #481 to make sure, this is not a duplicate. If this is a duplicate then I am very sorry for not linking them in the #314 issue.

Both PRs are targeting 3.1.0 which is not published yet but we are working on it. If you like to contribute to 3.1.0 then please look at the milestones at https://github.com/meteor/blaze/milestone/11

Let me know how to proceed here.

@nicolv
Copy link
Copy Markdown
Author

nicolv commented Apr 28, 2026

Thanks for the pointers! I've reviewed both PRs:

My PR still adds value on top of #495 because it gives developers control over the log level instead of forcing console.error for everyone. I'm happy to rebase onto release-3.1.0 if that's the preferred target branch. Let me know how you'd like to proceed!

@jankapunkt jankapunkt changed the base branch from master to release-3.1.0 April 28, 2026 09:12
@jankapunkt
Copy link
Copy Markdown
Collaborator

I changed the base to 3.1.0 but as you pointed out @nicolv you would have to rebase. Another important requirement for merging would be - that the default behavior (using console.log) remains untouched when not explicitly changed, in order to keep this working with APM tools.

Once you have rebased I am eager to review and test this one.

@jankapunkt jankapunkt added this to the 3.1 milestone Apr 28, 2026
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.

Template exceptions are using console.log not console.error

4 participants