Skip to content

Commit 34adaff

Browse files
committed
Raise HTTPError if a request fails
This way we'll see a problem in GitHub's UI, where delivered and failed webhook payloads are shown. Before this change the payload was marked as successfully delivered and only message like 'Created issue: 400' is shown in logs on Heroku. Part of #11
1 parent 74602ce commit 34adaff

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tarantoolbot.py

+3
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ def send_comment(body, issue_api, to):
8989
body = {'body': '@{}: {}'.format(to, body)}
9090
url = '{}/comments?access_token={}'.format(issue_api, token)
9191
r = requests.post(url, json=body)
92+
r.raise_for_status()
9293
print('Sent comment: {}'.format(r.status_code))
9394

9495
##
@@ -99,6 +100,7 @@ def get_comments(issue_api):
99100
body = {'since': '1970-01-01T00:00:00Z'}
100101
url = '{}/comments?access_token={}'.format(issue_api, token)
101102
r = requests.get(url, json=body)
103+
r.raise_for_status()
102104
return r.json()
103105

104106
##
@@ -117,6 +119,7 @@ def create_issue(title, description, src_url, author):
117119
body = {'title': title, 'body': description}
118120
url = '{}/issues?access_token={}'.format(doc_repo_url, token)
119121
r = requests.post(url, json=body)
122+
r.raise_for_status()
120123
print('Created issue: {}'.format(r.status_code))
121124

122125
##

0 commit comments

Comments
 (0)