Minor refactor of internal error handler

Remove dependancy on HTTP object, it was never really required
anyway as the code should always be determined by the type so this
makes it a little more robust in the future.
Also took this opportunity to tidy up some unnecessary new lines in
error statements