ocLazyLoad error promise result

Posted in General by chsarp Fri Dec 11 2015 13:51:30 GMT+0000 (Coordinated Universal Time)·1·Viewed 1,313 times

If error occurs during load, ocLazyLoad rejects the promise with following: .error(function (err) { deferred.reject(new Error('Unable to load template file "' + url + '": ' + err)); }); Here, original err result is converted to string and details such as status code are lost. I needed the status code to check 403 and handle the error. Is there any other way to access to status code?
Dec 11, 2015

That's a good point. If your problem is just with the template loader, it uses $http which means that you can use an interceptor: https://docs.angularjs.org/api/ng/service/$http#interceptors
If it's with all loaders, then no there is no way to get it right now. But it's a valid point, could you open an issue on the repository for that? I should return a complete error object.

Markdown is allowed