This is unrelated to this commit, but I think we need to improve these exception wrappers, they are hiding the underlying issue in a exception that isn't documented to be thrown in the first place. This leads to far less useful bug reports, like this one: https://jira.ez.no/browse/EZP-20490