Catch and log error when setting cache.

Now we'll know why and see if it is something we can fix.