You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Sometimes Jira returns `errorMessage` as a message error key
# for example for the "Service temporary unavailable" error
parsed_errors= [resp_data["errorMessage"]]
elif"errorMessages"inresp_data:
# Jira 5.0.x error messages sometimes come wrapped in this array
# Sometimes this is present but empty
error_messages=resp_data["errorMessages"]
iflen(error_messages) >0:
ifisinstance(error_messages, (list, tuple)):
parsed_errors=list(error_messages)
else:
parsed_errors= [error_messages]
elif"errors"inresp_data:
elif statements here causes the final block to not be executed when e.g. errorMessages is present, empty, but there is an errors array also in the returned error text.
For example, with the below content within error.text, parse_errors will always return an empty List:
{"errorMessages":[],"errors":{"assignee":"User \'[email protected]\' does not exist."}}
Changing the elif statements to if would ensure that the parser reaches the if "errors" in resp_data: block.
Is there an existing issue for this?
I have searched the existing issues
Jira Instance type
Jira Server or Data Center (Self-hosted)
Jira instance version
v9.14.0
jira-python version
3.6.0
Python Interpreter version
3.11.8
Which operating systems have you used?
Linux
macOS
Windows
Reproduction steps
# 1. When I try to update an issue with a non-existing user as the assignee# I want to catch that we have a "User foo@bar does not exist" type error, so I need to parse the returned error messages.defupdate_assigned(self, incident_id: str, owner: Owner):
self._update_token_silent()
self._logger.info(
"(TEST) Changing assignee for incident with id '%s' in JIRA: %s",
incident_id,
owner.email,
)
update: Dict= {"assignee": [{"set": {"name": owner.email}}]}
try:
jira_incident=self._get_issue(incident_id)
jira_incident.update(update=update)
exceptJIRAErrorase:
parsed_errors=self._parse_errors(e.response)
# if pattern in parsed_errors, handle in some wayself._logger.error("Error during update of JIRA issue: %s", e)
returnself._logger.info("Updated issue: %s", jira_incident.permalink())
# 2. When I call the function with a non existing user, parsed_errors is always empty
Stack trace
N/A
Expected behaviour
I would expect the function to return a list of error messages from the server error response.
Additional Context
No response
The text was updated successfully, but these errors were encountered:
Bug summary
jira/jira/resilientsession.py
Lines 108 to 121 in eb0ec90
elif
statements here causes the final block to not be executed when e.g.errorMessages
is present, empty, but there is anerrors
array also in the returned error text.For example, with the below content within
error.text
,parse_errors
will always return an empty List:{"errorMessages":[],"errors":{"assignee":"User \'[email protected]\' does not exist."}}
Changing the
elif
statements toif
would ensure that the parser reaches theif "errors" in resp_data:
block.Is there an existing issue for this?
Jira Instance type
Jira Server or Data Center (Self-hosted)
Jira instance version
v9.14.0
jira-python version
3.6.0
Python Interpreter version
3.11.8
Which operating systems have you used?
Reproduction steps
Stack trace
Expected behaviour
I would expect the function to return a list of error messages from the server error response.
Additional Context
No response
The text was updated successfully, but these errors were encountered: