Skip to content

feat: enhance CheckoutApiException to include request_id and improve error handling - #186

Merged
armando-rodriguez-cko merged 1 commit into
mainfrom
feature/feat-enhance-CheckoutApiException-to-include-request_id-and-improve-error-handling
Jul 25, 2025
Merged

feat: enhance CheckoutApiException to include request_id and improve error handling#186
armando-rodriguez-cko merged 1 commit into
mainfrom
feature/feat-enhance-CheckoutApiException-to-include-request_id-and-improve-error-handling

Conversation

@armando-rodriguez-cko

Copy link
Copy Markdown
Contributor

This pull request enhances the CheckoutApiException class to provide more detailed error information, including the request_id and error_type fields. It also updates the test suite to validate these new additions and ensures better error handling in various scenarios.

Enhancements to Exception Handling:

  • Updated the CheckoutApiException class to include request_id and error_type fields, populated from the response body or headers as a fallback. Improved error handling for missing or malformed JSON responses. (checkout_sdk/exception.py)
  • Updated the documentation to reflect the new request_id and error_type attributes in the exception handling example. (README.md)

Test Suite Updates:

  • Modified existing tests and added new ones to validate the presence of request_id and proper fallback mechanisms when it is missing in the response body. (tests/exception_test.py) [1][2]
  • Enhanced integration tests to assert the presence of request_id in error scenarios. (tests/payments/request_apm_payments_integration_test.py)

Miscellaneous:

  • Updated the expiry_year for VisaCard test data to extend its validity. (tests/checkout_test_utils.py)

@armando-rodriguez-cko
armando-rodriguez-cko requested a review from a teamJuly 25, 2025 09:12
Comment threadcheckout_sdk/exception.py Fixed
Comment threadtests/exception_test.py Dismissed
Comment threadtests/exception_test.py Dismissed
@armando-rodriguez-cko
armando-rodriguez-ckoforce-pushed the feature/feat-enhance-CheckoutApiException-to-include-request_id-and-improve-error-handling branch 5 times, most recently from 42eafd4 to a74ec3dCompareJuly 25, 2025 11:38
@armando-rodriguez-cko
armando-rodriguez-ckoforce-pushed the feature/feat-enhance-CheckoutApiException-to-include-request_id-and-improve-error-handling branch from a74ec3d to 6f7aef2CompareJuly 25, 2025 11:38
@sonarqubecloud

Copy link
Copy Markdown

Comment threadtests/exception_test.py Dismissed
@armando-rodriguez-cko
armando-rodriguez-cko merged commit db8f032 into mainJul 25, 2025
6 checks passed
@armando-rodriguez-cko
armando-rodriguez-cko deleted the feature/feat-enhance-CheckoutApiException-to-include-request_id-and-improve-error-handling branch July 25, 2025 12:35
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@armando-rodriguez-cko@github-advanced-security@gustavo-porto-cko