Why does templating-resources catch this error?

I’m seeing this totally expected error in the console but it never made it to our error reporting system which makes think its being caught here and printed to the console.

ERROR [templating-resources] Error: (SystemJS) XHR error loading blah/blah/blah.js

Is this not a terrible idea for the error not to bubble up to the unhandled error handler?

Might it be that bubbling it all up to browser will stop further execution?

It looks like that might be the case.

This seems dirty and my knowledge doesn’t stretch far enough to know whether the stack would be preserved correctly but I’m guessing it would allow execution to continue?

  composer.pendingTask = composer.pendingTask.catch(e => {
    setImmediate(() => {
      throw e;
  }).then(() => {

The alternative is to configure our error reporting library to hook console.error.

@timfish that is if you preserve development logging? or does it end up in console anyways?

We still log some info, warnings and errors to the console even in production. We use Sentry for error reporting and console entries end up in recorded breadcrumbs which can be quite useful.