Skip to content

Commit

Permalink
Webhook: Log uri
Browse files Browse the repository at this point in the history
  • Loading branch information
byewokko committed Jan 9, 2023
1 parent ed6eaf0 commit 726a8c7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions asab/storage/upsertor.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,15 +167,17 @@ def _webhook(self, data, uri, auth=None):
response = conn.getresponse()
if response.status // 100 != 2:
text = response.read()
L.error("Webhook endpoint responded with {}:\n{}".format(response.status, text))
L.error(
"Webhook endpoint responded with {}:\n{}".format(response.status, text),
struct_data={"uri": uri})
return
self.WebhookResponseData = json.load(response)
except ConnectionRefusedError:
L.error("Webhook call failed: Connection refused.", struct_data={"uri": uri})
return
except json.decoder.JSONDecodeError as e:
L.error("Failed to decode JSON response from webhook: {}".format(str(e)))
L.error("Failed to decode JSON response from webhook: {}".format(str(e)), struct_data={"uri": uri})
except Exception as e:
L.error("Webhook call failed with {}: {}".format(type(e).__name__, str(e)))
L.error("Webhook call failed with {}: {}".format(type(e).__name__, str(e)), struct_data={"uri": uri})
finally:
conn.close()

0 comments on commit 726a8c7

Please sign in to comment.