Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ extend-safe-fixes = [
"D415", # docstrings should end with a period, question mark, or exclamation point
]
ignore = [
"B904",
"BLE001",
"D100",
"D101",
Expand Down
8 changes: 4 additions & 4 deletions src/multisafepay/api/shared/cart/cart_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,10 @@ def add_tax_rate_percentage(

try:
self.tax_table_selector = str(tax_rate_percentage / 100)
except (ValueError, TypeError):
except (ValueError, TypeError) as e:
raise InvalidArgumentException(
"Tax rate percentage cannot be converted to a string.",
)
) from e

return self

Expand Down Expand Up @@ -316,10 +316,10 @@ def add_tax_rate(self: "CartItem", tax_rate: float) -> "CartItem":

try:
self.tax_table_selector = str(tax_rate)
except (ValueError, TypeError):
except (ValueError, TypeError) as e:
raise InvalidArgumentException(
"Tax rate cannot be converted to a string.",
)
) from e

return self

Expand Down
2 changes: 1 addition & 1 deletion src/multisafepay/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ def _create_request(
response.raise_for_status()
except RequestException as e:
if 500 <= response.status_code < 600:
raise ApiException(f"Request failed: {e}")
raise ApiException(f"Request failed: {e}") from e

context = context or {}
context.update(
Expand Down
4 changes: 2 additions & 2 deletions src/multisafepay/util/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ def validate(
transaction_json,
separators=(",", ":"),
)
except json.JSONDecodeError:
except json.JSONDecodeError as e:
raise InvalidArgumentException(
"Request must be a valid JSON string",
)
) from e

if validation_time_in_seconds < 0:
raise InvalidArgumentException(
Expand Down
4 changes: 2 additions & 2 deletions src/multisafepay/value_object/date.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ def __init__(self: "Date", date: str) -> None:
else:
timestamp = datetime.strptime(date, "%Y-%m-%d").timestamp()
super().__init__(timestamp=timestamp, str_date=date)
except ValueError:
except ValueError as e:
raise InvalidArgumentException(
f'Value "{date}" is an invalid date format',
)
) from e

def get(self: "Date", date_format: str = "%Y-%m-%d") -> str:
"""
Expand Down