witoldsz / angular-http-auth

MIT License
2.38k stars 418 forks source link

Error when config doesn't exist #118

Closed simison closed 8 years ago

simison commented 8 years ago

Seeing errors because of this line: https://github.com/witoldsz/angular-http-auth/blob/fb5bd0ee5eb001fb009616a82f44c35d1d6b862f/src/http-auth-interceptor.js#L54

Similar to this situation: https://github.com/chieffancypants/angular-loading-bar/pull/50

Basically I'm having this situation:

SyntaxError: Unexpected token <
    at Object.parse (native)
    at fromJson (http://localhost:3000/lib/angular/angular.js?c=1446764845080:1252:14)
    at defaultHttpResponseTransform (http://localhost:3000/lib/angular/angular.js?c=1446764845080:9414:16)
    at http://localhost:3000/lib/angular/angular.js?c=1446764845080:9505:12
    at forEach (http://localhost:3000/lib/angular/angular.js?c=1446764845080:336:20)
    at transformData (http://localhost:3000/lib/angular/angular.js?c=1446764845080:9504:3)
    at transformResponse (http://localhost:3000/lib/angular/angular.js?c=1446764845080:10276:23)
    at processQueue (http://localhost:3000/lib/angular/angular.js?c=1446764845080:14745:28)
    at http://localhost:3000/lib/angular/angular.js?c=1446764845080:14761:27
    at Scope.$eval (http://localhost:3000/lib/angular/angular.js?c=1446764845080:15989:28)

... but passes it onwards and is followed by this error:

TypeError: Cannot read property 'ignoreAuthModule' of undefined
    at responseError (http-auth-interceptor.js?c=1446764845080:60)
    at processQueue (angular.js?c=1446764845080:14745)
    at angular.js?c=1446764845080:14761
    at Scope.$eval (angular.js?c=1446764845080:15989)
    at Scope.$digest (angular.js?c=1446764845080:15800)
    at Scope.$apply (angular.js?c=1446764845080:16097)
    at done (angular.js?c=1446764845080:10546)
    at completeRequest (angular.js?c=1446764845080:10744)
    at XMLHttpRequest.requestLoaded (angular.js?c=1446764845080:10685)
witoldsz commented 8 years ago

Would #119 fix the problem?