TRUNK-4322: Fixed ugly error message

This is in the API, it is not good to use html. I would rather move this code to the controller