在 Angular 应用程序中,我们有一个解决 promise 的模式,在 Angular 1.6.0 之前一直为我们服务:
    resource.get().$promise
        .then(function (response) {
        // do something with the response
        }, function (error) {
            // pass the error the the error service
            return errorService.handleError(error);
        });
以下是我们在 Karma 中触发错误的方式:
    resourceMock.get = function () {
        var deferred = $q.defer();
        deferred.reject(error);
        return { $promise: deferred.promise };
    };
现在,随着 1.6.0 的更新,Angular 突然在我们的单元测试中(在 Karma 中)抱怨被拒绝的Promise并出现“可能未处理的拒绝”错误。但是我们正在调用我们的错误服务的第二个函数中处理拒绝。
Angular 到底在寻找什么?它希望我们如何“处理”拒绝?