XF 2.0 Best way to return a generic error to the end user?


Well-known member
In XF1, when I wanted to return a generic error to the end user, I used a throw exception:
throw new XenForo_Exception(new XenForo_Phrase('channel_url_did_not_match_services'), true);
Yeah, I know... probably not the most proper way to do things. But it worked very nicely.

Throwing exceptions in XF2 aren't really an option anymore, because exceptions XF2 aren't really generic anymore and also dump traces. What would be the best way to return generic errors to the end user in XF2 from a repository?