Handling 'Possibly Unhandled Rejection' in Angular 1.6

With the recent release of Angular 1.6, I’ve updated a codebase and ran into a new issue:

Possibly unhandled rejection: {"status":400,"statusText":"SearchCtrl._labot5d8x did not register the event: searching"}

Browser console error

The statusText above really isn’t super important. The Possibly unhandled rejection is the tricky one, due to its generic-ness.

In the codebase I’m working on, this is due to various promise-helper convenience functions bootstrapping but not having a promise immediately passed through them.

This was not an issue with Angular 1.5, so it appears that 1.6 is somewhat more strict (not necessarily a bad thing at all).

Here is how to shut this off:

app.config(['$qProvider', function($qProvider) {
     $qProvider.errorOnUnhandledRejections(false);
 }]);

This was actually causing some strange behavior until added to the app config – these console errors were not harmless. Hopefully this helps someone else.

Jeremy Collins

Jeremy Collins
I'm a Software Engineer, most interested in developing attractive, fast, component-based progressive webapps. I also tinker with mobile app development for fun.

React app code splitting with React-Loadable dynamic imports, using TypeScript and WebPack

A few setting changes were needed in order to get my react app code-splitting properly in a project with TypeScript and WebPack Continue reading

Node OAuth Starter Project uploaded

Published on August 11, 2018

Codable Web Development Tools for iOS released

Published on December 19, 2017