Pr/exception refactoring

PR version of https://github.com/spotify/crtauth-java/issues/25