-
Notifications
You must be signed in to change notification settings - Fork 411
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
Getting "undefined method presence
for "Not Found":String" error when issue is not found
#432
Comments
It's failing because Net:HTTP can't open the URL and get a response. I got this error when the config options |
Point of the report is that library should be prepared for this case probably and not crash with @message = response.try(:message).try(:presence) || response.try(:body) instead of @message = response.try(:message).presence || response.try(:body) seem to do the trick... |
The response was successfully received and it was UPD:
So the issue is not related to |
@tory-kk when using the latest version from my The most recent PR that touched on this specific issue is #435.
My source 'https://rubygems.org'
gem 'jira-ruby', git: 'https://github.com/sumoheavy/jira-ruby', branch: 'master' If you check out ...
# Returns the response if the request was successful (HTTP::2xx) and
# raises a JIRA::HTTPError if it was not successful, with the response
# attached.
def request(*args)
response = make_request(*args)
raise HTTPError, response unless response.is_a?(Net::HTTPSuccess)
response
end
... And here's my response when requesting an issue that doesn't exist:
When I request an issue that doesn't exist, I am receiving an begin
client.Issue.find('NOEXIST-2')
rescue => e
puts JSON.parse(e.response.body.inspect)
end Then you'll see what you're looking for: {"errorMessages":["Issue does not exist or you do not have permission to see it."],"errors":{}} I think it will be OK to flag this as a duplicate for now, but wanted to run this by you before closing, since it should be working in the upcoming version :) Thanks! UPDATE 2024-04-27 |
For anyone else who finds this before it's released, I was able to work around this by using the require from the previously linked #435 after I required this gem. Like so:
|
Hello,
I am getting the following error when the issue is not found:
Jira-ruby version:
2.3.0
.Enabled
http_debug
and added logs:Please advise on how it could be fixed.
UPD: Jira JSON response:
The text was updated successfully, but these errors were encountered: