Skip to content

fix(errors): surface docUrl from the API error envelope on ZernioApiError - #11

Merged
Zernio-Elean merged 1 commit into
mainfrom
fix/error-docurl
Sep 15, 2026
Merged

Zernio-Elean merged 1 commit into
mainfrom
fix/error-docurl

Conversation

@Zernio-Elean

Copy link
Copy Markdown
Contributor

Summary

  • fix(errors): carry the whole API error envelope on ZernioApiError #10 made ZernioApiError carry the API error envelope, but docUrl was still dropped.
  • The API emits docUrl on the 404 catch-all (app/api/[...notFound]/route.ts) and on 402 payment required (libs/billing/lifecycle/require-payment-method.ts), so integrators could not read it from the SDK.

Changes

  • ZernioErrorBody and ZernioApiError gain docUrl, assigned from the parsed body.
  • RateLimitError and ValidationError inherit it through the shared body argument, no signature changes.
  • Additive only, patch.

Testing

  • Extended the parseApiError carries the whole envelope suite: docUrl surfaced from a full envelope, undefined when there is no body.
  • Test fails without the src/errors.ts change, 206/206 pass with it; tsc --noEmit and eslint clean.

Follow-up (not in this PR)

  • platformError is typed Record<string, unknown>, but the API sends a plain string for Reddit and Google Business (libs/utils/reddit-api.ts:179, libs/accounts/token/googlebusiness-lane.ts:147). Changing it to unknown would break consumers compiling against 0.2.785, so it needs a decision with the fix(errors): carry the whole API error envelope on ZernioApiError #10 author.

Crisp

https://app.crisp.chat/website/20dea5d6-a684-4c80-b097-2258b0b41421/inbox/session_38ff6d04-e5b8-41b1-a32c-2d6f3f4aa3ec/

…rror

PR #10 modelled type, param, platform, platformError and details but
dropped docUrl, which the API emits for 404 routes and 402 payment
required. Add it to ZernioErrorBody and ZernioApiError; RateLimitError
and ValidationError inherit it through the shared body argument.
@Zernio-Elean
Zernio-Elean merged commit 510d92b into main Sep 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant