import { $scramjet } from "../scramjet"; export function errorTemplate(trace: string, fetchedURL: string) { // turn script into a data URI so we don"t have to escape any HTML values const script = ` errorTrace.value = ${JSON.stringify(trace)}; fetchedURL.textContent = ${JSON.stringify(fetchedURL)}; for (const node of document.querySelectorAll("#hostname")) node.textContent = ${JSON.stringify(location.hostname)}; reload.addEventListener("click", () => location.reload()); version.textContent = ${JSON.stringify($scramjet.version.version)}; build.textContent = ${JSON.stringify($scramjet.version.build)}; document.getElementById('copy-button').addEventListener('click', async () => { const text = document.getElementById('errorTrace').value; await navigator.clipboard.writeText(text); const btn = document.getElementById('copy-button'); btn.textContent = 'Copied!'; setTimeout(() => btn.textContent = 'Copy', 2000); }); `; return ` Scramjet

Uh oh!

There was an error loading

Try:

  • Checking your internet connection
  • Verifying you entered the correct address
  • Clearing the site data
  • Contacting 's administrator
  • Verify the server isn't censored

If you're the administrator of , try:

  • Restarting your server
  • Updating Scramjet
  • Troubleshooting the error on the GitHub repository

Scramjet v (build )

`; } export function renderError(err: unknown, fetchedURL: string) { const headers = { "content-type": "text/html", }; if (crossOriginIsolated) { headers["Cross-Origin-Embedder-Policy"] = "require-corp"; } return new Response(errorTemplate(String(err), fetchedURL), { status: 500, headers: headers, }); }