{#- chirp-ui: ASCII Error Page Stylized error state with ASCII art compositions for common HTTP errors. Usage: from "chirpui/ascii_error.html" import ascii_error {% call ascii_error(code="404") %} Go home {% end %} {% call ascii_error(code="500", heading="Something broke", description="We're looking into it.") %} {% end %} Codes: 404, 403, 500, 503, timeout, empty -#} {% def ascii_error(code="404", heading="", description="", cls="") %} {% set _codes = { "404": { "heading": "Page not found", "desc": "The page you're looking for doesn't exist or has been moved.", "art": [ " ┌─────────┐ ", " │ 4 ◇ 4 │ ", " └────┬────┘ ", " │ ", " ◇ ── ★ ── ◇ ", " │ ", " · · ", ], }, "403": { "heading": "Access denied", "desc": "You don't have permission to view this page.", "art": [ " ╔═══╗ ", " ║ ⛓ ║ ", " ╔══╬═══╬══╗ ", " ║ ┃ ┃ ║ ", " ║ ┃ ◆ ┃ ║ ", " ╚══╩═══╩══╝ ", ], }, "500": { "heading": "Internal server error", "desc": "Something went wrong on our end.", "art": [ " · ✦ · ★ · ", " ╱ ◇ ╲ ", " ╱ 5·0·0 ╲ ", " ╱ · · · · ╲ ", " ╱───────────╲ ", " · ★ · ✦ · ", ], }, "503": { "heading": "Service unavailable", "desc": "We're temporarily offline for maintenance.", "art": [ " ┌──────────┐ ", " │ ⚙ · ⚙ │ ", " │ ◎ │ ", " │ ·╱ ╲· │ ", " └──╱───╲───┘ ", " ▪ ▪ ▪ ▪ ▪ ", ], }, "timeout": { "heading": "Request timed out", "desc": "The server took too long to respond.", "art": [ " ╭───╮ ", " ╱ ⟳ ╲ ", " │ · · · │ ", " │ ◎ │ ", " ╲ · · ╱ ", " ╰───╯ ", " · · · · ", ], }, } %} {% set _fallback = { "heading": "Something went wrong", "desc": "An unexpected error occurred.", "art": [ " · ✦ · ", " ◇ ◇ ", " · ★ · ", " ◇ ◇ ", " · ✦ · ", ], } %} {% set _info = _codes[code] if code in _codes else _fallback %} {% set _heading = heading if heading else _info["heading"] %} {% set _description = description if description else _info["desc"] %} {% set _art = _info["art"] %}
{{ _description }}