Skip to content

fix(errors): preserve API error details - #156

Open
Diego Barajas (barajas-d) wants to merge 5 commits into
masterfrom
hotfix/error-detail-fallback
Open

Diego Barajas (barajas-d) wants to merge 5 commits into
masterfrom
hotfix/error-detail-fallback

Conversation

@barajas-d

Copy link
Copy Markdown
Contributor

Summary

Preserve useful error details when an API response has no top-level message, such as an Order API 402 body containing errors and data.

Changes

  • Populate exception message and error with the API message, or the complete serialized body when it is absent.
  • Fall back to the HTTP status if the body is empty or cannot be serialized.
  • Apply the same fallback to MPResponse.error_message for unsuccessful responses.
  • Preserve the parsed response in exception.response.

Compatibility

exception.error previously held the API error code; it now contains the message or serialized body. Consumers needing the original code can read exception.response["error"]. The fallback can include all fields in the API response.

Validation

  • Python syntax check and isort check passed.
  • Repository pre-commit checks passed.
  • Automated tests and live Order requests were not run locally.

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