Skip to content

Kount_Ris_Request::getResponse to throw exception if error in the API request#22

Open
tisogawa wants to merge 2 commits intoKount:masterfrom
tisogawa:fix/exception-on-error
Open

Kount_Ris_Request::getResponse to throw exception if error in the API request#22
tisogawa wants to merge 2 commits intoKount:masterfrom
tisogawa:fix/exception-on-error

Conversation

@tisogawa
Copy link

@tisogawa tisogawa commented Dec 7, 2022

When there is an error in the API request, the Kount_Ris_Request::getResponse() function doesn't surface it. The function returns a normal Kount_Ris_Response object instead as if the request was successful. However, the returned object consists of empty or invalid data so it cannot be used for further data processing. The function should raise an appropriate error in this case. Otherwise, the users of the SDK need to check the validity of the returned object by themselves before proceeding.

In this PR, I changed the Kount_Ris_Request::getResponse() function to throw Kount_Ris_Exception (which has no use as of now) on a cURL error or on the HTTP status code >= 400.

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