-
Notifications
You must be signed in to change notification settings - Fork 27.4k
$templateCache / $compile loses error context when HTTP request for template fails #10514
Comments
@niallsmart what would you, ideally, like to see as the additional context? I can think of HTTP response status code / text. But you can get those from the network of a browser's dev tool. The trouble I can see here is that a promise can be either rejected with a failed HTTP response (I guess this would be a standard case) or with any other object ($http interceptors can do whatever they want...). So it will be a bit tricky to get perfectly meaningful details in all the cases... |
@pkozlowski-opensource yeah, the console is definitely the best way to debug this exception on developer machines. however, the context is that we're seeing this exception intermittently on end-user browsers – it's reported to us via our exception tracking system, but hard to debug without more context on why the requests are failing. Re implementation, while interceptors could reject with any random object, couldn't that be considered breaking the |
@niallsmart so, at the end of the day we've got only 2 pieces of info that might help tracking down issues: http response status code / text. I wonder if this would be enough to track down the problems you end-users are seeing... |
@pkozlowski-opensource well, the status code would definitely be useful context but I agree, there's probably not enough to track down the root cause. in this particular case there seems to be an unreliable proxy somewhere in the chain which is dropping the connection and Chrome reports the code as "0". What are your thoughts on including |
Actually in Angular 1.3's $templateRequest, that's going to look more like this:
Alternatively you could just pass in the |
@niallsmart I'm not sure dumping the whole response makes much sense as it can be rather large object (for example it has entire config inside). Looking at all the fields of $http response I think that the only reasonable, additional info is response status / statusText. |
@pkozlowski-opensource ah yes, totally agree. Logging |
The
$templateCache
service throws an exception if the HTTP request to fetch the template fails, however the exception message contains no useful context other than the fact that the request failed.The exception should include the error code and other context.
https://github.com/angular/angular.js/blob/g3_v1_3/src/ng/templateRequest.js#L52
The text was updated successfully, but these errors were encountered: