blaze icon indicating copy to clipboard operation
blaze copied to clipboard

Template exceptions are using console.log not console.error

Open haveaguess opened this issue 4 years ago • 9 comments
trafficstars

We dont see template exceptions bubble up into our unhandled exception handler (Sentry) because Blaze catches them and reports to console as info, instead of as error.

image

image

Equally what if I want my app to fail fast on any template error instead of continuing in a broken state? This is not possible because blaze doesn't have option to rethrow/bubble up unhandled?

We're using Meteor 1.10.1

haveaguess avatar Dec 15 '20 20:12 haveaguess

Although this sounds like a reasonable change to Blaze it could cause side effects on legacy apps. Maybe a simple fix is to overwrite Blaze._reportException = (e, msg) => console.error(e, msg) in your app.

softwarerero avatar Jan 17 '21 14:01 softwarerero

We could also add this new feature as an option, like log levels.

Like on mongo package we allow many config options via settings, see one example https://docs.meteor.com/api/collections.html#mongo_connection_options_settings

We could have something like:

"packages": {
    "blaze": {
      "logLevel": {
        "error": "error"
      }
    }
  }

and in this case the default would be and not requiring any setting.

"logLevel": {
    "error": "info"
}

filipenevola avatar Jan 17 '21 19:01 filipenevola

Hi, as we are not having many discussions around this issue I'm closing it.

Of course, if we have new ideas or problems we can re-open it. No problem.

filipenevola avatar Mar 18 '21 20:03 filipenevola

Hi @filipenevola sorry I didn't come back on your suggestion, it was simply because I thought it was a final proposal and I agreed 100% :)

Ultimately our only option to get visibility on critical issues happening in our app today (via Sentry.io for example) will be to monkey patch the log handling as suggested by @softwarerero which leaves me concerned about unexpected future breakages and unexpected behaviour.

Having first class logger support and options like you have suggested would be amazing

haveaguess avatar Apr 13 '21 15:04 haveaguess

A similar annoyance for the community is the way Method callbacks squash exceptions that are rethrown as well :

https://forums.meteor.com/t/sentry-raven-with-meteor-on-server/32383/20

If you are planning improvements, recommend looking at what you can do here too

haveaguess avatar Apr 16 '21 15:04 haveaguess

Maybe we could utilize the logging package for this and then we would have one central place to make additional improvements.

StorytellerCZ avatar Apr 26 '21 13:04 StorytellerCZ