Skip to content
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

Not differentiating between an error and no result on user search #1804

Open
2 of 4 tasks
cheshirex opened this issue Jan 23, 2024 · 0 comments
Open
2 of 4 tasks

Not differentiating between an error and no result on user search #1804

cheshirex opened this issue Jan 23, 2024 · 0 comments

Comments

@cheshirex
Copy link

Bug summary

I encountered some failures in my testing yesterday where Jira was intermittently failing to find a user who exists. The error is no longer occurring, but I'm theorizing that I was getting rate-limiting errors on the query.

The problem is that the call to search_users just returned an empty list. From what I can see, the call stack is search_users -> _fetch_page -> _get_json, which does not seem to check the status code of the get call, but instead blindly calls json_loads on the response, which will result in an empty list. Since an empty list is a valid response in the case where a successful search doesn't find a user, I can't differentiate between the case where the user isn't found and when the search failed because of some error.

Thanks!

Is there an existing issue for this?

  • I have searched the existing issues

Jira Instance type

Jira Cloud (Hosted by Atlassian)

Jira instance version

No response

jira-python version

3.6.0

Python Interpreter version

3.9

Which operating systems have you used?

  • Linux
  • macOS
  • Windows

Reproduction steps

# 1. Given a Jira client instance
jira: JIRA
# 2. When I call search_users with a user that I know exists
result = jira.search_users(query='I_exist@company.com')
# 3. But we are currently being rate-limited by Atlassian cloud
# At this point result is an empty list -- but I would expect an exception to have been raised.

Stack trace

Note that there was no error/exception from the jira package.
The stack including line numbers from PyCharm from a normal user search call from my test:
_get_json, client.py:3939
_fetch_pages, client.py:737
search_users, client.py:3571
<module>, scratch.py:79

Expected behaviour

If the HTTP response code is not 2xx, I would expect a JIRAError exception to be raised

Additional Context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant