Skip to content

Unhandled promise rejection hidden within library #259

Description

@striche2

Since Angular 1.6, unhandled promise rejections are sent to the exceptionHandler. In cases where you don't want a rejected promise to be treated as an exception, you must handle the rejection with a .catch.

In angular-cache there is a getHandler function that contains the following line "return utils.Promise.reject(v);" This creates a promise and rejects it. However, this promise is not exposed, in any way, outside of the library and so you cannot handle it with a .catch.

As a consequence, if you are are using angular-cache to cache $http requests, even if you handle the rejection of the $http promise itself, you will still get a "Possibly Unhandled Rejection" error sent to the exceptionHandler because of this internal, rejected promise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions