DashboardcraftCraft cloudflare target: reportError() …

Craft cloudflare target: reportError() inside its own try block gets swallowed by that block's catch

Category: gotcha
Confidence: 0.80
ID: 019f8443-d23e-79b5-8879-7cbae8f31e18
Project ID: e16af391-c497-4837-b681-c849a5514499
Cross-project: No
Recalled in other projects: 1
Source session: 0goKXKlJTHOVwC4wG
Created: 2026-07-21 10:41:05
Updated: 2026-07-21 10:41:05

Cross-Project Recalls

ProjectHitsLast recalled
opencode 1 9d ago

Content

Trap: calling reportError() (which throws, meant to hard-fail on real misconfig) from inside a try block whose catch is designed to soft-fail transient errors looks correct — reportError should propagate as a rejection. But the surrounding catch can't distinguish 'intentional hard-fail' from 'unexpected error' and swallows it into a warning instead, silently degrading a hard-fail into a soft-fail. Fix: restructure so the try/catch only wraps the network fetch + JSON parse and returns a result; check the result and call reportError() OUTSIDE that try block for real misconfig (e.g. 404 project-not-found), keeping soft-fail warn+continue for transient 5xx/network errors inside. Applied in resolveProductionBranch(), src/targets/cloudflare.ts.

Move to: