Clear data from cache on error

This is similar to what is done for the $http service.