Skip to content

Conversation

@zulquer
Copy link
Collaborator

@zulquer zulquer commented May 7, 2025

This pull request introduces several changes to improve error handling by adding exception chaining (from e) across multiple methods. Additionally, it includes a minor update to the pyproject.toml configuration. Below is a summary of the most important changes:

Improved error handling with exception chaining:

  • src/multisafepay/api/shared/cart/cart_item.py:

    • Updated the add_tax_rate_percentage method to include exception chaining when raising InvalidArgumentException for invalid tax rate percentages.
    • Updated the add_tax_rate method to include exception chaining when raising InvalidArgumentException for invalid tax rates.
  • src/multisafepay/client/client.py:

    • Modified the _create_request method to add exception chaining when raising ApiException for server errors (HTTP 5xx).
  • src/multisafepay/util/webhook.py:

    • Enhanced the validate method to include exception chaining when raising InvalidArgumentException for invalid JSON strings.
  • src/multisafepay/value_object/date.py:

    • Updated the __init__ method of the Date class to include exception chaining when raising InvalidArgumentException for invalid date formats.

Configuration updates:

  • pyproject.toml:
    • Removed the B904 error code from the ignore list in the configuration file.

@zulquer zulquer requested a review from Copilot May 7, 2025 09:20
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves error handling by introducing exception chaining across multiple methods and updates the project configuration by removing the ignored error code "B904".

  • Adds exception chaining in date parsing, JSON validation, API request handling, and tax rate conversion methods.
  • Updates the pyproject.toml to remove "B904" from the ignore list.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/multisafepay/value_object/date.py Implements exception chaining in the Date initializer for invalid date formats.
src/multisafepay/util/webhook.py Enhances JSON validation by adding exception chaining for JSON decoding errors.
src/multisafepay/client/client.py Adds exception chaining in the _create_request method when handling server errors.
src/multisafepay/api/shared/cart/cart_item.py Uses exception chaining in tax rate conversion methods for improved error propagation.
pyproject.toml Removes "B904" from the ignore list to enforce updated error handling rules.

@codecov
Copy link

codecov bot commented May 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.76%. Comparing base (fdcbfeb) to head (f677c76).
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master      #21   +/-   ##
=======================================
  Coverage   90.76%   90.76%           
=======================================
  Files         106      106           
  Lines        2306     2306           
=======================================
  Hits         2093     2093           
  Misses        213      213           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@zulquer zulquer merged commit 670996a into master May 7, 2025
7 checks passed
@zulquer zulquer deleted the PTHMINT-50 branch May 7, 2025 09:23
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.

2 participants