-
Notifications
You must be signed in to change notification settings - Fork 250
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
Error handler returns nothing for 400 errors #521
Comments
Experiencing this same issue |
Have the same problem. This might be because the code expects the quickbooks response header as "application/xml" while the actual response has "application/xml;charset=UTF-8". The code at IntuitResponse::setFaultHandler() expects "application/xml".
|
OK, I tried to figure out how to fix this, but didn' t get all that far, since for some reason the parsing fails, there's nothing more to When you call your API Client function - in this example it's Add() - do this:
Then in the code that calls this function, switch to try/catch:
Finally, here's the method that parses the exception text using the Laravel Str helper class in a very quick and dirty manner, I spent like 5 minutes writing this:
Like I said, this is quick and dirty and could certainly be improved, but at least now you're able to see what error you got and work with this info. |
This worked for me. $error = $this->data_service->getLastError();
if ($error) {
$err = $error->getResponseBody();
}
|
We have fundamentally working integration. However, sometimes we get a 400 Error and in this case, the following code
All these calls other than the getHttpStatusCode() call return nothing.
Is this a bug or are we using an incorrect method to get the cause of a 400 error?
The text was updated successfully, but these errors were encountered: