Skip to content

feat!: gateway errors carry the real message and code; a refused 200 fails - #13

Merged
Domantas merged 1 commit into
mainfrom
fix/sdk-errors
Sep 22, 2026
Merged

Domantas merged 1 commit into
mainfrom
fix/sdk-errors

Conversation

@Domantas

Copy link
Copy Markdown
Contributor

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).

…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>
@Domantas
Domantas merged commit 29ff61d into main Sep 22, 2026
8 checks passed
@Domantas
Domantas deleted the fix/sdk-errors branch September 22, 2026 09:38
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