Comments (5)
An underlying issue is that Guzzle throws a RequestException which the documentation does not show anywhere and naturally truncates data after 120 characters. This means any data AvaTax sends after 120 characters is useless to the developers.
Furthermore, setting catch exceptions to false almost always sends the same stack trace that points to RequestException.php line 113 because Guzzle is reading the HTTP error codes. If you want the AvaTax error to match their documentation, you will need to catch the exception and return the response body similar to this:
if ($exception instanceof \GuzzleHttp\Exception\RequestException) {
$body = $exception->getResponse()->getBody();
$errorInfo = json_decode($body->read($body->getSize()));
}
Edit: fixed formatting and had json_decode return an object to match Avalara\ErrorInfo
from avatax-rest-v2-php-sdk.
I believe you can set the client to not catch exceptions and actually throw them:
$client = new AvaTaxClient(...);
$client->withCatchExceptions(false);
from avatax-rest-v2-php-sdk.
I believe you can get the full exception response string just by casting the body to a string.
$errorMessage = (string)$throwable->getResponse()->getBody();
from avatax-rest-v2-php-sdk.
Yep, this is correct, the StreamInterface has a __toString method defined but one thing to note is PHP does not allow throwing an exception while casting to a string so if there was some underlying throwable, you will get an empty string back rather than the throwable which could make it harder to debug.
from avatax-rest-v2-php-sdk.
This issue is fixed as part of #183. Please verify and revert if in case it is not resolved at your end.
from avatax-rest-v2-php-sdk.
Related Issues (20)
- PHP 8 Support HOT 9
- How to CreateCustomers in PHP SDK HOT 1
- how to resolve Address result HOT 1
- Refund Transaction creates transaction with all zero amounts HOT 3
- Timeout Hardcoded HOT 2
- How do I specify a unit for parameters that accept units? HOT 2
- Magento 2.4.4 setup:di:compile error for lib 23.6.0 HOT 3
- downloadTaxRatesByZipCode endpoint fails with unexpected format HOT 1
- How to handling error? HOT 1
- Avalara\AvaTaxClient" not found
- How to omit tax codes in transactions HOT 2
- Address model cannot be set with locationCode HOT 1
- Keep SDK version in constant and use it across requests HOT 2
- During Composer install, AvaTaxClientBase not passing in params needed to load HOT 2
- File has mixed line endings; this may cause incorrect results HOT 1
- AvaTaxClient methods no longer returning API JSON error message for HTTP 4** etc responses. HOT 1
- Transactions are not being reported in real-time in the dashboard HOT 1
- Try/catch is not firing on exception and server is responding with 502 error for transaction with invalid addresses HOT 1
- Missing method to set $this->_model['email '] (Customer Email) HOT 1
- commitTransaction method not behaving as expected, has incorrect inline documentation HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from avatax-rest-v2-php-sdk.