state: more error tracing and logging

Added error tracing using the errors package and more logging with the hope of finding the cause for CI bugs.

It does not fix lp:1348477 (auth fails), but hopefully will provide a lot more context why it happens on the bot.
This looks a lot like an accident