fix(cli): exception to prevent swallowing unexpected errors (#31983)

This commit is contained in:
Michael Li 2025-07-17 00:23:43 +10:00 committed by GitHub
parent 5a4c0c0816
commit 12d370a55a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,6 +2,8 @@ import http.client
import json import json
from typing import Any, Optional, TypedDict from typing import Any, Optional, TypedDict
import typer
WRITE_KEY = "310apTK0HUFl4AOv" WRITE_KEY = "310apTK0HUFl4AOv"
@ -37,5 +39,6 @@ def create_events(events: list[EventDict]) -> Optional[Any]:
res = conn.getresponse() res = conn.getresponse()
return json.loads(res.read()) return json.loads(res.read())
except Exception: except (http.client.HTTPException, OSError, json.JSONDecodeError) as exc:
typer.echo(f"Error sending events: {exc}")
return None return None