Skip to content

Commit

Permalink
adding error recovery to linking tickets
Browse files Browse the repository at this point in the history
  • Loading branch information
nbshiland committed Jul 31, 2024
1 parent a36632f commit 3010f9b
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions abr-testing/abr_testing/automation/jira_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,25 @@ def link_issues(self, to_link: list, ticket_key: str) -> None:
"type": {"name": "Relates"},
}
)
response = requests.post(
f"{self.url}/rest/api/3/issueLink",
headers=self.headers,
auth=self.auth,
data=link_data,
)
try:
response = requests.post(
f"{self.url}/rest/api/3/issueLink",
headers=self.headers,
auth=self.auth,
data=link_data,
)
response.raise_for_status()
except requests.exceptions.HTTPError:
print(
f"HTTP error occurred. Ticket ID {issue} was not linked. \
Check user permissions and authentication credentials"
)
except requests.exceptions.ConnectionError:
print(f"Connection error occurred. Ticket ID {issue} was not linked.")
except json.JSONDecodeError:
print(
f"JSON decoding error occurred. Ticket ID {issue} was not linked."
)

def open_issue(self, issue_key: str) -> str:
"""Open issue on web browser."""
Expand Down

0 comments on commit 3010f9b

Please sign in to comment.