MCPcopy Create free account
hub / github.com/cloudflare/moltworker / transformErrorMessage

Function transformErrorMessage

src/index.ts:40–50  ·  view source on GitHub ↗

* Transform error messages from the gateway to be more user-friendly.

(message: string, host: string)

Source from the content-addressed store, hash-verified

38 * Transform error messages from the gateway to be more user-friendly.
39 */
40function transformErrorMessage(message: string, host: string): string {
41 if (message.includes('gateway token missing') || message.includes('gateway token mismatch')) {
42 return `Invalid or missing token. Visit https://${host}?token={REPLACE_WITH_YOUR_TOKEN}`;
43 }
44
45 if (message.includes('pairing required')) {
46 return `Pairing required. Visit https://${host}/_admin/`;
47 }
48
49 return message;
50}
51
52/**
53 * Check if an error indicates the gateway process has crashed.

Callers 1

index.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected