Tidy up backend error handling.

This handles all errors here, which will aviod duplicating generic
errors between the error json log and the STDERR output.
Merge pull request #64 from alphagov/cleaner_error_handling

Tidy up backend error handling.