-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues with error extraction in API response validation #24
Comments
Sounds good to me. Pull Requests to improve the error handling are welcome. |
Hi Greg. Only iATS team can improve error handling of its PHP wrapper because the response format is not documented. Also, it is common practice for a PHP library to throw exceptions with meaningful error messages and codes, instead of asking library users to extract the error messages from raw text strings and/or do guesswork regarding undocumented response format. Currently, we have no other options but to output a generic error message - this confuses clients and they will contact our and your support team every time they cannot guess the issue on their own. As a result, by improving the error handling in iATS PHP library, you will improve the experience of the iATS users and avoid some support requests. |
We will be working on this feature in the near future. We'll ping you when we have a new version with more robust error message handling. |
Thanks, greatly appreciated! |
iATS PHP Examples speak very little about how to interpret and extract API errors. As a result, an iATS partner that uses the PHP API wrapper cannot provide detailed and meaningful error messages to their clients.
Take as an example the following PHP code using the iATS PHP wrapper:
This code not only follows the examples from iATS documentation, but also additionally parses error messages from authentication results messages prefixed with
0Error
. Please note that looking for "0ERROR:" substring in AUTHORIZATIONRESULT is something that can be found imperically, but is not documented.Using iATS' PHP library usually looks like the following code:
As it can be seen, one has to guess to extract any useful error details, yet there is still no good way which would always allow to extract useful error message and use it to give feedback to clients.
Ideally, PHP wrappers should do the API result validation on its own and
just throw some kind of IatsApiException with correct error message and code,
which the API user can then display to their clients.
In simpler words, the API client should only care about how to handle exceptions, but it is the API library that should throw them with useful information structured.
The text was updated successfully, but these errors were encountered: