File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 11import discord_logging
2+ import prawcore .exceptions
23
34log = discord_logging .get_logger ()
45
@@ -44,7 +45,13 @@ def send_queued_notifications(reddit, database):
4445
4546 body_bldr = utils .get_footer (notification .render_notification (submissions ))
4647 subject_bldr = notification .render_subject ()
47- result = reddit .send_message (notification .subscription .subscriber .name , '' .join (subject_bldr ), '' .join (body_bldr ))
48+ try :
49+ result = reddit .send_message (notification .subscription .subscriber .name , '' .join (subject_bldr ), '' .join (body_bldr ))
50+ except prawcore .exceptions .ServerError :
51+ log .warning (f"Failure sending notification message to u/{ notification .subscription .subscriber .name } " )
52+ log .warning (f"Subject: { '' .join (subject_bldr )} " )
53+ log .warning (f"Body: { '' .join (body_bldr )} " )
54+ raise
4855 notification .submission .messages_sent += 1
4956 if result != ReturnType .SUCCESS :
5057 counters .api_responses .labels (call = 'notif' , type = result .name .lower ()).inc ()
You can’t perform that action at this time.
0 commit comments