Refactored errors into their own module, fixed a test which was wrong.
Keyrings: Fix merge conflicts