Give more detailed error message when failing to post to bluesky
authorMagnus Hagander <magnus@hagander.net>
Thu, 20 Feb 2025 14:32:35 +0000 (15:32 +0100)
committerMagnus Hagander <magnus@hagander.net>
Thu, 20 Feb 2025 14:32:35 +0000 (15:32 +0100)
postgresqleu/util/messaging/bluesky.py

index 4c5a1cecb7bb029a1c97b64f5064cae28a422d31..e202758b73848ce7e183cf73a233a60c2db9f045 100644 (file)
@@ -178,6 +178,11 @@ class Bluesky(object):
             },
             timeout=10,
         )
+        if r.status_code == 400 and r.headers.get('content-type').startswith('application/json'):
+            return (None, 'Post error: {}, message {}'.format(
+                r.json()['error'],
+                r.json()['message'],
+            ))
         r.raise_for_status()
         return (r.json()['uri'], None)