Просмотр исходного кода

Include HTTP status and content-type in Homestay session expired error

ZiB 4 месяцев назад
Родитель
Сommit
51f8ab2ee5
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      room_cal/service_api/_homestay.py

+ 3 - 1
room_cal/service_api/_homestay.py

@@ -76,7 +76,9 @@ class _HomestayClient:
       raise HomestayAuthError(f'Homestay calendar fetch failed (HTTP {r.status_code}) — run: {_AUTH_HINT}')
     if 'application/json' not in r.headers.get('content-type', ''):
       mark_stale('homestay')
-      raise HomestayAuthError(f'Homestay session expired — run: {_AUTH_HINT}')
+      raise HomestayAuthError(
+        f'Homestay session expired (HTTP {r.status_code}, content-type: {r.headers.get("content-type", "none")!r}) — run: {_AUTH_HINT}'
+      )
     return r.json()
 
   async def _get_calendar_data(self) -> dict: