Skip to content

abso-core

Public

abso is version control for agents: the client, the engine and a server you can run on your own Cloudflare account.

Check passed

Versions 48 to 49

Compare

+30 −0 in 1 place
new file, 30 lines
1+// errorSentence: what an error answer says, from JSON or from the host's HTML error page.
2+
3+import assert from "node:assert/strict";
4+import { test } from "node:test";
5+import { errorSentence } from "../src/api-error.ts";
6+
7+test("a JSON answer gives its error, else its reason", () => {
8+ assert.equal(errorSentence('{"error":"no such draft"}'), "no such draft");
9+ assert.equal(errorSentence('{"reason":"paused"}'), "paused");
10+ assert.equal(errorSentence("plain words"), "plain words");
11+});
13+test("an HTML error page is said by its title and Ray ID, not its first lines", () => {
14+ const page = `<!DOCTYPE html>
15+<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en-US"> <![endif]-->
16+<head>
17+<title>Worker threw exception | example.workers.dev | Cloudflare</title>
18+</head>
19+<body>${"<div></div>\n".repeat(50)}
20+<span>Cloudflare Ray ID: <strong class="font-semibold">8c1f2e3d4a5b6c7d</strong></span>
21+</body></html>`;
22+ assert.equal(
23+ errorSentence(page),
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',
25+ );
26+ assert.equal(
27+ errorSentence("<html><body>oops</body></html>"),
28+ "an HTML error page, not the server's own answer: the server failed before it could say why",
29+ );
30+});
MCP
compare on this site's /mcp
CLI
abso diff 48 49 client/test/error-sentence.test.ts --json
JSON
/christopher/abso-core/compare/48..49?file=client%2Ftest%2Ferror-sentence.test.ts&format=json