Repository navigation
fix(errors): surface docUrl from the API error envelope on ZernioApiError - #11
Merged
Merged
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ZernioApiErrorcarry the API error envelope, butdocUrlwas still dropped.docUrlon 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
ZernioErrorBodyandZernioApiErrorgaindocUrl, assigned from the parsed body.RateLimitErrorandValidationErrorinherit it through the sharedbodyargument, no signature changes.Testing
parseApiError carries the whole envelopesuite:docUrlsurfaced from a full envelope, undefined when there is no body.src/errors.tschange, 206/206 pass with it;tsc --noEmitand eslint clean.Follow-up (not in this PR)
platformErroris typedRecord<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 tounknownwould 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/