Skip to content

The field id is missing in the error message #1580

@zhan9san

Description

@zhan9san

if isinstance(errors, dict) and "message" not in errors:
error_msg_list.extend(list(errors.values()))

  File "/usr/local/lib/python3.11/site-packages/atlassian/jira.py", line 1861, in set_issue_status
    return self.post(url, data=data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/atlassian/rest_client.py", line 388, in post
    response = self.request(
               ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/atlassian/rest_client.py", line 312, in request
    self.raise_for_status(response)
  File "/usr/local/lib/python3.11/site-packages/atlassian/rest_client.py", line 551, in raise_for_status
    raise HTTPError(error_msg, response=response)
requests.exceptions.HTTPError: This field is required

I find the dict is supported in HTTPError. Is it necessary to convert it to a string?

from requests import HTTPError

errors = {
    "duedate": "Field 'duedate' cannot be set. It is not on the appropriate screen, or unknown.",
    "assignee": "Field 'assignee' cannot be set. It is not on the appropriate screen, or unknown.",
}

raise HTTPError(errors)

Output

Traceback (most recent call last):
    raise HTTPError(errors)
requests.exceptions.HTTPError: {'duedate': "Field 'duedate' cannot be set. It is not on the appropriate screen, or unknown.", 'assignee': "Field 'assignee' cannot be set. It is not on the appropriate screen, or unknown."}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions