import html
ERROR_PAGE_TEMPLATE = """
Energy Optimization System (EOS) Error
STATUS_CODE
ERROR_TITLE
ERROR_MESSAGE
ERROR_DETAILS
Back to Home
"""
def create_error_page(
status_code: str, error_title: str, error_message: str, error_details: str
) -> str:
"""Create an error page by replacing placeholders in the template."""
return (
ERROR_PAGE_TEMPLATE.replace("STATUS_CODE", status_code)
.replace("ERROR_TITLE", error_title)
.replace("ERROR_MESSAGE", html.escape(error_message))
.replace("ERROR_DETAILS", html.escape(error_details))
)