-
-
Notifications
You must be signed in to change notification settings - Fork 877
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
log detail miss between jira-3.2.0 and jira-3.4.1 #1606
Comments
I was somewhat able to reproduce this error I used the following: jira: JIRA
try:
issue = jira.create_issue(
summary="Test issue created",
project=jira.projects()[0].key,
issuetype={"name": "BadIssueType"},
description="foo description",
)
except Exception as e:
print("String print:" + str(e)) # empty
print(e.text) # '{"errorMessages":[],"errors":{"issuetype":"Specify an issue type"}}'
# raise e # Raises traceback as expected This is the exception raised: Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\adeha\Documents\GitHub\jira\jira\client.py", line 1521, in create_issue
r = self._session.post(url, data=json.dumps(data))
File "C:\Users\adeha\Documents\GitHub\jira\.tox\py310\lib\site-packages\requests\sessions.py", line 635, in post
return self.request("POST", url, data=data, json=json, **kwargs)
File "C:\Users\adeha\Documents\GitHub\jira\jira\resilientsession.py", line 241, in request
elif raise_on_error(response, **processed_kwargs):
File "C:\Users\adeha\Documents\GitHub\jira\jira\resilientsession.py", line 69, in raise_on_error
raise JIRAError(
jira.exceptions.JIRAError: JiraError HTTP 400 url: https://pycontribs.atlassian.net/rest/api/2/issue
response headers = { ... }
response text = {"errorMessages":[],"errors":{"issuetype":"Specify an issue type"}}
Therefore the issue lies in in the parser for error messages, where we are using an I think the best option is to not use an else if condition and instead keep appending error messages as we go through the returned dictionary. Although perhaps we don't need to try anything fancy and simply return the response as it is, perhaps a simple |
@studioj any thoughts? |
We had the same issue here at my company trying out the new version. I agree that removing the Complementary to this change, I'd suggest combining the conditions with a value check on the repository, to also use python truthiness check and validate that even if the key exist, it should have an actual value (sorry, I couldn't resist adding some walrus operators to make things more pythonic 😅 ) if "message" in resp_data:
# ...
elif resp_errors := resp_data.get("errorMessage", [])
# ...
elif resp_errors := resp_data.get("errorMessages", []):
# ...
elif resp_errors := resp_data.get("errors", []):
# ...
return parsed_errors |
Bug summary
Hi!
This week I update jira lib from 3.2.0 to 3.4.1, after this update, when create issue failed, there is no enough log detail
in 3.2.0
in 3.4.1
Is there an existing issue for this?
Jira Instance type
Jira Cloud (Hosted by Atlassian)
Jira instance version
NONE
jira-python version
3.4.1
Python Interpreter version
3.10.5
Which operating systems have you used?
Reproduction steps
Stack trace
Expected behaviour
print the error detail
Additional Context
No response
The text was updated successfully, but these errors were encountered: