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

JIRA: Missing error msg #1363

Open
itsidorkin opened this issue Apr 8, 2024 · 0 comments
Open

JIRA: Missing error msg #1363

itsidorkin opened this issue Apr 8, 2024 · 0 comments

Comments

@itsidorkin
Copy link

Related: #919 #1154

Starting from version 3.32.2, the cause of the error disappeared.

For example:

from atlassian import Jira

jira = Jira(
    url="https://mysite.com",
    username="username",
    password="password"
)

fields = {
    "summary": "this summary"
}

jira.issue_create(fields)

In version 3.32.1 the error text looked like this:

Traceback (most recent call last):
  File "...\mwv.py", line 14, in <module>
    jira.issue_create(fields)
  File "...\.venv\Lib\site-packages\atlassian\jira.py", line 1250, in issue_create
    return self.post(url, data={"fields": fields})
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...\.venv\Lib\site-packages\atlassian\rest_client.py", line 310, in post
    response = self.request(
               ^^^^^^^^^^^^^
  File "...\.venv\Lib\site-packages\atlassian\rest_client.py", line 243, in request
    self.raise_for_status(response)
  File "...\.venv\Lib\site-packages\atlassian\rest_client.py", line 405, in raise_for_status
    raise HTTPError(error_msg, response=response)
requests.exceptions.HTTPError: project: project is required

In versions after 3.32.1 (and in the current version 3.41.11 too), the error text looks like this:

Traceback (most recent call last):
  File "...\mwv.py", line 14, in <module>
    jira.issue_create(fields)
  File "...\.venv2\Lib\site-packages\atlassian\jira.py", line 1537, in issue_create
    return self.post(url, data={"fields": fields})
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "...\.venv2\Lib\site-packages\atlassian\rest_client.py", line 388, in post
    response = self.request(
               ^^^^^^^^^^^^^
  File "...\.venv2\Lib\site-packages\atlassian\rest_client.py", line 312, in request
    self.raise_for_status(response)
  File "...\.venv2\Lib\site-packages\atlassian\rest_client.py", line 549, in raise_for_status
    raise HTTPError(error_msg, response=response)
requests.exceptions.HTTPError

project: project is required is not printed.

def raise_for_status in the rest_client.py file of the current version (3.41.11)

Open the file at line 539. If we runprint(errors) we get: {'project': 'project is required'}. Note
that the key is a field that is necessary to create a ticket and which is not in the fields variable. However,
on line 541 we do errors.get("message", ""). Of course, inside errors there is no message key, so the
error text errors does not end up in error_msg

@itsidorkin itsidorkin changed the title JIRA: Missing error cause JIRA: Missing error msg Apr 8, 2024
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