Skip to content

Commit

Permalink
Merge pull request #133 from gdi2290/patch-2
Browse files Browse the repository at this point in the history
feat(responseError): log error if not config
  • Loading branch information
chieffancypants committed Feb 17, 2015
2 parents 3231cd9 + 3b52012 commit 25f7e26
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/loading-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ angular.module('chieffancypants.loadingBar', ['cfp.loadingBarInterceptor']);
angular.module('cfp.loadingBarInterceptor', ['cfp.loadingBar'])
.config(['$httpProvider', function ($httpProvider) {

var interceptor = ['$q', '$cacheFactory', '$timeout', '$rootScope', 'cfpLoadingBar', function ($q, $cacheFactory, $timeout, $rootScope, cfpLoadingBar) {
var interceptor = ['$q', '$cacheFactory', '$timeout', '$rootScope', '$log', 'cfpLoadingBar', function ($q, $cacheFactory, $timeout, $rootScope, $log, cfpLoadingBar) {

/**
* The total number of requests made
Expand Down Expand Up @@ -120,6 +120,9 @@ angular.module('cfp.loadingBarInterceptor', ['cfp.loadingBar'])
},

'responseError': function(rejection) {
if (!rejection.config) {
$log.error('Other interceptors are not returning config object \n https://github.com/chieffancypants/angular-loading-bar/pull/50');
}
if (!rejection.config.ignoreLoadingBar && !isCached(rejection.config)) {
reqsCompleted++;
$rootScope.$broadcast('cfpLoadingBar:loaded', {url: rejection.config.url, result: rejection});
Expand Down

0 comments on commit 25f7e26

Please sign in to comment.