mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 12:57:40 +00:00
(fix): handle Cloudflare 521 and transient 5xx errors gracefully (#13500)
Merged via /review-pr -> /prepare-pr -> /merge-pr.
Prepared head SHA: a8347e95c5
Co-authored-by: rodrigouroz <384037+rodrigouroz@users.noreply.github.com>
Co-authored-by: Takhoffman <781889+Takhoffman@users.noreply.github.com>
Reviewed-by: @Takhoffman
This commit is contained in:
@@ -22,4 +22,16 @@ describe("formatRawAssistantErrorForUi", () => {
|
||||
"HTTP 500: Internal Server Error",
|
||||
);
|
||||
});
|
||||
|
||||
it("sanitizes HTML error pages into a clean unavailable message", () => {
|
||||
const htmlError = `521 <!DOCTYPE html>
|
||||
<html lang="en-US">
|
||||
<head><title>Web server is down | example.com | Cloudflare</title></head>
|
||||
<body>Ray ID: abc123</body>
|
||||
</html>`;
|
||||
|
||||
expect(formatRawAssistantErrorForUi(htmlError)).toBe(
|
||||
"The AI service is temporarily unavailable (HTTP 521). Please try again in a moment.",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user