FYI FOSRestBundle provides a way to whitelist for which exception classes the message should be exposed in production.