"""
Error handlers for the application
"""

from flask import render_template, current_app


def register_error_handlers(app):
    """Register error handlers with the app"""
    
    @app.errorhandler(404)
    def not_found_error(error):
        current_app.logger.error(f'404 error: {error}')
        return render_template('errors/404.html'), 404
    
    @app.errorhandler(500)
    def internal_error(error):
        current_app.logger.error(f'500 error: {error}')
        return render_template('errors/500.html'), 500
    
    @app.errorhandler(413)
    def too_large(error):
        current_app.logger.error(f'413 error - File too large: {error}')
        return render_template('errors/413.html'), 413