-
Notifications
You must be signed in to change notification settings - Fork 46
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
raise_http_exception.rb#parse_json: undefined method []
for ni:NilClass (NoMethodError)
#125
Comments
When Now, no such exception is raised, and as soon as one tries to use that Enumerator, the unhandled exception, noted above, arises. I am digging more into finding out in which version this behavior has emerged. Likely due to the faraday change, etc. |
I am getting warmer. In 3.0.0, qbo_api would raise a QboApi::BadRequest exception. In 3.0.1, the error is unhandled resulting in the NoMethodError in the top post here in this issue. |
I have isolated the behavior change. To be clear, there are two behavior changes.
In 3.0.0, qbo_api raises a QboApi::BadRequest exception for the same example as above, eg:
This, perhaps, is an indicator of how the latest Faraday sets a 400 instead of 401 when the credentials are nil (?).
The NoMethodError, as reported in the top post of this issue, is raised. When I revert 8ea982e , a QboApi::BadRequest is raised. |
Hi @ybakos. Thanks so much for this research and breakdown. I'll take a closer look at this soon. |
The gem is catching |
@minimul Hi, I am not sure what your last comment is indicating. If you try:
You will see that qbo_api is not catching an exception, or it is not checking for a situation and raising a QboApi exception. |
It was in reference to your comment
So I guess that is not the problem since I agree that an exception should be raised as that is the past behavior. That said, I'm personally not on 3.x and won't be for a bit so I'm open to PRs but I won't be digging into this anytime soon. |
yes, I do think my PR would fix the NoMethodError you are experiencing because |
I'll take a look soon. |
@ybakos Make sure you are on version |
nm. jus looked through commit history. |
When my app has not o-authed with QBO, the qbo_api used to elegantly raise an exception, that we could rescue and do a redirect.
v3.0.1 seems to have a regression.
/Users/ybakos/.rvm/gems/ruby-3.1.1@rugged_thread/gems/qbo_api-3.0.1/lib/qbo_api/raise_http_exception.rb:72:in
parse_json': undefined method
[]' for nil:NilClass (NoMethodError)To replicate:
Do not have a valid authentication token.
Invoke
qbo_api.all(:customer_type).count
.The behavior was different in 2.0.2.
The text was updated successfully, but these errors were encountered: