DRY error response handling

An addendum to #418. Just cleans up the error rendering. 
Line is too long. [90/80]<br>Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.