Repository navigation
fix(errors): carry the whole API error envelope on ZernioApiError - #10
Merged
Merged
Conversation
parseApiError built the error from body.error, body.code and body.details only, so of the seven canonical ErrorResponse fields it surfaced three. type, param, platform and platformError were dropped on EVERY endpoint. For Meta sends that is fatal to error handling: a closed messaging window and a blocked recipient both arrive as code platform_api_error, and only platformError.subcode separates them, which was the field being dropped. - ZernioApiError exposes type, param, platform and platformError, plus `body` with the parsed response verbatim for anything not modelled - RateLimitError and ValidationError keep the API's own code and details instead of overwriting them with a generic one, so a Google Ads quota 429 stays distinguishable from a Zernio rate limit - reported by an integrator, first raised 57 releases ago Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Kq8TeJSGdkrGv4evwMBfJ8
2 tasks done
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.
Why
Reported by an integrator, and first raised 57 releases ago (0.2.727, now 0.2.784).
parseApiErrorbuiltZernioApiErrorfrombody.error,body.codeandbody.detailsonly. The canonicalErrorResponsehas seven fields, sotype,param,platformandplatformErrorwere dropped on every endpoint, not just sends.For Meta this breaks error handling outright: a closed messaging window and a blocked recipient both arrive as code
platform_api_error, andplatformError.subcodeis the only thing that tells them apart. That was exactly the field being discarded, so callers could see that Meta refused but never why.What
ZernioApiErrorexposestype,param,platformandplatformError, plusbodycarrying the parsed response verbatim so nothing the API adds later is lost again.RateLimitErrorandValidationErrorkeep the API's owncodeanddetailsrather than overwriting them with a generic value. A Google Ads quota 429 (code: rate_limited,details.quotaExhausted,details.quotaScope) now stays distinguishable from a Zernio rate limit.206 tests, typecheck and lint all pass.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Kq8TeJSGdkrGv4evwMBfJ8