function createErrorResponse()

in app/routes/api.auth.github.callback.tsx [286:322]


function createErrorResponse(errorMessage: string): Response {
  return new Response(
    `
    <!DOCTYPE html>
    <html>
      <head>
        <title>GitHub Authentication Error</title>
        <style>
          body { font-family: system-ui, sans-serif; text-align: center; padding: 50px; }
          .error { color: #DC2626; }
        </style>
      </head>
      <body>
        <div class="error">
          <h2>⚠ GitHub Authentication Failed</h2>
          <p>${errorMessage}</p>
        </div>
        <script>
          if (window.opener) {
            window.opener.postMessage({
              type: 'GITHUB_OAUTH2_ERROR',
              error: '${errorMessage}'
            }, window.location.origin);
            window.close();
          } else {
            window.location.href = '/?error=' + encodeURIComponent('${errorMessage}');
          }
        </script>
      </body>
    </html>
    `,
    {
      status: 200,
      headers: { "Content-Type": "text/html" },
    }
  );
}