Repository navigation
feat!: gateway errors carry the real message and code; a refused 200 fails - #13
Merged
Merged
Conversation
…on a failed answer The gateway puts the message and the error code inside `responseStatus.errors[]`. The SDK read the top of the body, so callers saw the whole JSON as the message and the code `HTTP_404` (#66). It also treated every 2xx as a success, while the gateway answers a business refusal with HTTP 200 and `responseStatus.isSuccess = False` (#67). The new `error_from_body` reads `responseStatus.errors[]` first (first entry for the message and the code, every entry kept in the new `NorbixError.errors` as `ErrorItem`), falls back to the top of `responseStatus`, then to the top of the body when there is no `responseStatus`, and only then to `Request failed (HTTP <status>)` with the code `HTTP_<status>`. `NorbixError` also keeps the answer in `body` and answers `http_status` / `error_code`. Both the sync and the async transport now raise on a 200 whose body says `isSuccess: False`. Binary answers (file download, the public file link) return before the check and are unchanged. BREAKING CHANGE: a call the gateway refused with HTTP 200 and `responseStatus.isSuccess = False` used to come back as a value and now raises a NorbixError with http_status 200. Code that checked `result["responseStatus"]["isSuccess"]` itself moves into a try / except. See the "Errors" section of the README. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
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.
BREAKING CHANGE: errors now carry the gateway's own message/errorCode from responseStatus.errors[]; an HTTP 200 with responseStatus.isSuccess=false now fails. Report: sdks/cli fix/sdk-errors docs/tasks/sdk-errors.md (slice ERRORS, Files campaign 10b, issues #66 #67).