Skip to content

Commit

Permalink
Merge pull request #28 from Muhammadali-Akbarov/enhancement/readme
Browse files Browse the repository at this point in the history
enhancement handle payme error
  • Loading branch information
Muhammadali-Akbarov authored Nov 22, 2024
2 parents b007033 + a3d5fb5 commit 7810e0c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion payme/classes/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,5 @@ def handle_payme_error(self, error: dict):
error_data = error.get("data", "")

exception_class = exc.errors_map.get(error_code, exc.BaseError)
raise exception_class(message=error_message, data=error_data)
exception_class.message = error_message
raise exception_class(data=error_data)
11 changes: 10 additions & 1 deletion payme/exceptions/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ def __init__(self, data=None):
super().__init__(-32602, self.message, data)


class InvalidTokenFormat(CardError):
"""Invalid token format during card operation."""
message = "Invalid token format."

def __init__(self, data=None):
super().__init__(-32500, self.message, data)


class AccessDeniedError(CardError):
"""Access denied for the card operation."""
message = "Access denied."
Expand Down Expand Up @@ -246,5 +254,6 @@ def __init__(self, message="No receipts found for the given transaction ID.", da
-31101: OtpExpiredError,
-31102: OtpAttemptsExceededError,
-31103: OtpInvalidCodeError,
-31602: ReceiptsNotFoundError
-31602: ReceiptsNotFoundError,
-32500: InvalidTokenFormat
}
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name='payme-pkg',
version='3.0.10',
version='3.0.11',
license='MIT',
author="Muhammadali Akbarov",
author_email='muhammadali17abc@gmail.com',
Expand Down

0 comments on commit 7810e0c

Please sign in to comment.