Flask: How do you render a custom error page AND get a Sentry alert?

Solution
from sentry_sdk import capture_exception

@app.errorhandler(Exception)
def internal_server_error(error):
    capture_exception(error)
    template_name, context = ErrorPages().error500(error)
    return (render_template(template_name, **context), 500)