Auto-update: Mon Oct 28 12:37:27 PDT 2024

This commit is contained in:
sanj 2024-10-28 12:37:27 -07:00
parent 4d8866e70a
commit f7f6e3e30e

View file

@ -71,14 +71,14 @@ async def post_time_entry_to_timing(entry: Dict):
try: try:
async with httpx.AsyncClient() as client: async with httpx.AsyncClient() as client:
response = await client.post(url, headers=headers, json=entry) response = await client.post(url, headers=headers, json=entry)
response.raise_for_status() # Raises exception for 4xx/5xx responses response.raise_for_status()
return response.json() return response.json()
except httpx.HTTPStatusError as exc: except httpx.HTTPStatusError as exc:
l.debug(f"HTTPStatusError caught: Status code: {exc.response.status_code}, Detail: {exc.response.text}") l.debug(f"HTTPStatusError caught: Status code: {exc.response.status_code}, Detail: {exc.response.text}")
raise HTTPException(status_code=exc.response.status_code, detail=str(exc.response.text)) raise HTTPException(status_code=exc.response.status_code, detail=exc.response.text)
except Exception as exc: except Exception as exc:
l.debug(f"General exception caught: {exc}") l.debug(f"General exception caught: {exc}")
raise HTTPException(status_code=500, detail="An unexpected error occurred") raise HTTPException(status_code=500, detail=str(exc))
@timing.post("/time/post_old") @timing.post("/time/post_old")