Issue error handling and minor improvements

Added error-handling for issue-ing. Tweaked the state system to stay
in a consistent state. Handling of server side errors remains to be done.
Merge branch 'refactor' of github.com:credentials/irma_web_service into refactor