commit 41593c8ea6d503d895094ac147dc9a92d3ab5cd6
parent 8748d8d0e3aa5e4b0b9f2c9ef15cb410cefbe007
Author: david cochran <about.trout@gmail.com>
Date: Sun, 1 Mar 2026 13:00:06 -0800
catch files_upload failures
Diffstat:
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/ppboatwatch/ppbbww.py b/ppboatwatch/ppbbww.py
@@ -107,19 +107,22 @@ async def post_match(client, frame_file, thread_ts):
chan_name, chan_id = "#boatwatch", "C06LMBRNV8U"
frame_ts = frame_file.split("/")[-1].split("-")[0]
with open(frame_file, "rb") as f:
- res = await client.files_upload_v2(
- channel=chan_id,
- thread_ts=thread_ts,
- file=f,
- filename=frame_ts,
- )
- if not res["ok"]:
- logging.error(f"Failed to post_match: {res}")
- return
+ try:
+ res = await client.files_upload_v2(
+ channel=chan_id,
+ thread_ts=thread_ts,
+ file=f,
+ filename=frame_ts,
+ )
+ if not res["ok"]:
+ logging.error(f"Failed to post_match: {res}")
+ return
+ except Exception as ex:
+ logging.error(f"Slack files_upload_v2 failed with exception: {ex}")
file_id = res.get("files")[0].get("id")
-
attempt = 0
+
while attempt < 10:
attempt += 1
try: