from flask import render_template, request

from app import app


@app.errorhandler(403)
def forbidden(error):
    return render_template('403.html', message=error.description)


@app.errorhandler(404)
def page_not_found(error):
    app.logger.error('Page not found: {}'.format(request.path))
    return render_template('404.html'), 404


@app.errorhandler(500)
def internal_server_error(error):
    app.logger.error('Server Error: {}'.format(error))
    return render_template('500.html', support_email=app.config.get('SUPPORT_EMAIL')), 500
