Catch HTTP Status 500 IllegalArgumentException

I have implemented secure user based access to views once a user logs into my app. For example, user A cannot see the views that user B has an vice versa. This works well however i would like to catch/manage the errors if user A tries to manually type in a view in the address bar which user B has access to.

If user A tries to access a user B view, he will get a HTTP Status 500 IllegalArgumentException from the navigator. Instead of showing the user an Exception report in the browser, how can i make this more user friendly? I would like to catch this error and then redirect the user to another view

Please advise



I think the correct approach would be to add a ViewChangeListener to the Navigator to prevent the error from occurring in the first place , look at
for an example ( not sure if the example is up to date ).