Handling uncaughtPromiseErrors

I have an application with async child routes. Following this link, I created a custom exception handler and caught all the base exceptions, but I cannot handle any uncaughtPromiseErrors (template parse errors, etc.) that are being thrown in Angular polyfills.

These uncaught errors are hanging the application and the only solution is to reload the app. These errors are breaking the app/route-table before I catch the errors in the custom exception handler.

Few questions:

  1. Is it possible to handle these uncaughterrors in such a way that they will not crash the application?
  2. Should I override any methods in the Angular polyfills?
  3. Why the template parse errors are uncaughterros? Can they be registered as base exceptions, so that it is possible to catch them in the custom handler?

Leave a Reply

1 Comment threads
0 Thread replies
Most reacted comment
Hottest comment thread
1 Comment authors
Jason Recent comment authors
newest oldest most voted
Notify of

In fact template parsing errors are caught by the custom exception handler. I try and I receive the following error for example in the exception handler: InstantiationError { _wrapperMessage: "DI Exception", _originalException: BaseException, _originalStack: "Error: Template parse errors:↵Unexpected closing t…larjs.org/2.0.0-beta.15/angular2.dev.js:12520:29)", _context: null, _wrapperStack: "Error: DI Exception↵ at InstantiationError.Wrap…ularjs.org/2.0.0-beta.15/angular2.dev.js:12987:39" } The problem is if you have such errors it’s impossible to recover without fixing the problem and reloading the application. I also made a test with observable for an HTTP request that fails and I don’t define an error callback. The exception handler also catch the error (in this case, the… Read more »