DRY error response handling

An addendum to #418. Just cleans up the error rendering. 
Trailing whitespace detected.