[READ-ONLY] Mirror of https://github.com/okikio/bundlejs-api.

fix(cloudflare): return debug-friendly worker errors master

Cloudflare was falling back to its default error page when the worker threw an uncaught exception. That made debugging much harder because users could not see the actual failure coming from bundlejs. Wrap the worker fetch handler in a top-level error boundary and always return an application-controlled response. Reuse the existing HTML error rendering for thrown msg payloads, and return JSON for unexpected failures with useful fields such as the error message, stack, cause, and status when available. This keeps internal worker failures visible to users and makes production issues diagnosable without relying on Cloudflare's branded error pages. The worker typecheck still passes after the change.


+212 -147
1 changed file