mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-19 19:11:33 +00:00
fix(cli): exception to prevent swallowing unexpected errors (#31983)
This commit is contained in:
parent
5a4c0c0816
commit
12d370a55a
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user