This Fixes #1061

There's some code repetition here, better to always generate the `<BR>ERROR` part, and prefix with custom_msg when necessary