diff options
| author | Elis Eriksson <spelis.tech@gmail.com> | 2026-03-27 21:31:23 +0100 |
|---|---|---|
| committer | Elis Eriksson <spelis.tech@gmail.com> | 2026-03-27 21:31:23 +0100 |
| commit | ae399cf38d26715c4a09b029b849abace3c3f309 (patch) | |
| tree | 77279de195a5c2b2ac6ab91fd1d0bbc4f7fb8c37 /content | |
| parent | e0cb53c4f4b257fc92b40e176c37f8b699d645f3 (diff) | |
| download | spelis-web-ae399cf38d26715c4a09b029b849abace3c3f309.tar spelis-web-ae399cf38d26715c4a09b029b849abace3c3f309.tar.gz spelis-web-ae399cf38d26715c4a09b029b849abace3c3f309.tar.bz2 spelis-web-ae399cf38d26715c4a09b029b849abace3c3f309.tar.lz spelis-web-ae399cf38d26715c4a09b029b849abace3c3f309.tar.xz spelis-web-ae399cf38d26715c4a09b029b849abace3c3f309.tar.zst spelis-web-ae399cf38d26715c4a09b029b849abace3c3f309.zip | |
add error page
Diffstat (limited to 'content')
| -rw-r--r-- | content/error.njk | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/content/error.njk b/content/error.njk new file mode 100644 index 0000000..61c45d5 --- /dev/null +++ b/content/error.njk @@ -0,0 +1,76 @@ +<h1 id="error-code">Error</h1> +<img src="" id="error-image" style="width: 100%;"> + +<script> + const params = new URLSearchParams(window.location.search) + const code = params.get("code") || "404" + + // yes, i typed these out manually. + const messages = { + 400: "Bad request", + 401: "Unauthorized", + 402: "Payment required", + 403: "Forbidden", + 404: "Not found", + 405: "Method not allowed", + 406: "Not acceptable", + 407: "Proxy authentication required", + 408: "Request timeout", + 409: "Conflict", + 410: "Gone", + 411: "Length required", + 412: "Precondition failed", + 413: "Payload too large", + 414: "Request-URI too long", + 415: "Unsupported media type", + 416: "Request range not satisfiable", + 417: "Expectation failed", + 418: "I'm a teapot", + 419: "Page expired", + 420: "Enhance your calm", + 421: "Misdirected request", + 422: "Unprocessable entity", + 423: "Locked", + 424: "Failed dependency", + 425: "Too early", + 426: "Upgrade required", + 428: "Precondition Required", + 429: "Too many requests", + 431: "Request header fields too large", + 444: "No response", + 450: "Blocked by windows parental controls", + 451: "Unavailable for legal reasons", + 495: "SSL certificate error", + 496: "SSL certificate required", + 497: "HTTP request sent to HTTPS port", + 498: "Token expired/invalid", + 499: "Client closed request", + + + 500: "Internal server error", + 501: "Not implemented", + 502: "Bad gateway", + 503: "Service unavailable", + 504: "Gateway timeout", + 506: "Variant also negotiates", + 507: "Insufficient storage", + 508: "Loop detected", + 509: "Bandwidth limit exceeded", + 510: "Not extended", + 511: "Network authentication required", + 521: "Web server is down", + 522: "Connection timed out", + 523: "Origin is unreachable", + 525: "SSL handshake failed", + 530: "Site frozen", + 599: "Network connect timeout error" + } + + document.getElementById("error-code").textContent = "Error " + code + " - " + (messages[code] || "Unexpected error") + const host = Math.random() < 0.5 ? "cat" : "dog"; + const url = host === "dog" + ? `https://http.dog/${code}.jpg` + : `https://http.cat/${code}`; + + document.getElementById("error-image").src = url; +</script> |
