Typed failures and diagnostics
Adapter design. This page specifies the unpublished adapter. Run a request with Octokit and Effect.
Use a discriminated adapter error channel. Preserve the original cause for explicit inspection. Define a separate safe rendering for logs and traces: causes may contain headers, query parameters, OAuth material or full webhook payloads. Cross-package duplicate classes and cross-realm errors make sole reliance on instanceof brittle.
| Evidence | Classification and retained information |
|---|---|
| Octokit HTTP error with response | HTTP failure with status, headers, request ID and optional response data. Preserve 304, 401, 403, 404, 409, 422 and 5xx distinctly through status. Avoid inferring resource existence from a 404. |
| 429, or 403 with quota/secondary-limit evidence | Rate-limited failure; retain available retry-after seconds, reset epoch, remaining quota and primary/secondary/unknown evidence. An ordinary 403 is a permission failure. Missing or malformed hints remain unknown. |
| Fetch rejects without HTTP response | Transport failure with cause. Octokit can assign synthetic status 500; this does not establish a server response. |
| GraphQL errors with optional partial data | GraphQL failure with paths, locations, extensions, response headers and typed partial data where possible. HTTP 200 can carry this failure. |
| Auth exchange, invalid webhook/signature, handler aggregate, pagination protocol | Preserve operation context, aggregate children or upstream reason. Classify an HTTP error during authentication without discarding HTTP evidence. A false return from standalone verify remains a successful boolean. |
| Caller abort, fiber interrupt, unknown SDK rejection | Distinguish caller cancellation, runtime interruption and unknown failure. Preserve non-Error rejections; never stringify them blindly. Keep handler defects in their originating Cause where the bridge permits it. |
Check headers case-insensitively. Keep common fields low-cardinality and omit raw request/response bodies from default serialization. Use a whitelist for diagnostics even when the upstream error redacts its authorization header. RequestError · GraphQL error · Rate limits