I am new in writing flask and currently use flask-principal as my authorization mechanism.
When a user tries to access a url without the required permission, flask-principal raises a PermissionDenied Exception.
It causes my system to throw a 500 internal server error.
How could I catch the specific exception and redirect user to a warning page instead? If you could share a code example, that will be very helpful.