Errors: say an HTML error page by its title and Ray ID
of shared·pinch··Not checked
When the server fails before it can answer, its host sends an HTML error page instead. The client printed the page's first 300 characters, which are all doctype and IE comments, so nobody could tell what had failed: "GET /a/me/status answered 500: <!DOCTYPE html> <!--[if lt IE 7]> ...".
Now an HTML answer reads: answered 500: an HTML error page titled "Worker threw exception | ... | Cloudflare" (Ray ID ...), not the server's own answer: the server failed before it could say why. The title and Ray ID are what an operator needs to find the failure. JSON answers and plain text are said as before. Tested in error-sentence.test.ts.
57+ const title = plain(/<title>([\s\S]*?)<\/title>/i.exec(body)?.[1] ?? "");
58+ const ray = /Ray ID:\s*(?:<[^>]*>\s*)*([0-9a-f]+)/i.exec(body)?.[1];
59+ return `an HTML error page${title !== "" ? ` titled ${JSON.stringify(title)}` : ""}${ray ? ` (Ray ID ${ray})` : ""}, not the server's own answer: the server failed before it could say why`;
24+ 'an HTML error page titled "Worker threw exception | example.workers.dev | Cloudflare" (Ray ID 8c1f2e3d4a5b6c7d), not the server\'s own answer: the server failed before it could say why',