The first option is simply to hide an error with disabling it by configuring errorOnUnhandledRejections in $qProvider configuration as suggested Cengkuru Michael
BUT this will only switch off logging. The error itself will remain
The better solution in this case will be - handling a rejection with .catch(fn) method:
resource.get().$promise
.then(function (response) {})
.catch(function (err) {});
LINKS:
- Promise
- Angular:
- Migrating Angular 1.5 to 1.6
- $http: remove deprecated callback methods: 'success()/error()'