Skip to content

Commit 7203fef

Browse files
committed
fixes
1 parent 693b174 commit 7203fef

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/replit_river/client.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
)
1414

1515
from replit_river.client_transport import ClientTransport
16-
from replit_river.error_schema import RiverError, RiverException
16+
from replit_river.error_schema import ERROR_CODE_UNKNOWN, RiverError, RiverException
1717
from replit_river.transport_options import (
1818
HandshakeMetadataType,
1919
TransportOptions,
@@ -36,7 +36,6 @@ class RiverUnknownValue(BaseModel):
3636
value: Any
3737

3838

39-
@dataclass(frozen=True)
4039
class RiverUnknownError(RiverError):
4140
pass
4241

@@ -56,7 +55,7 @@ def translate_unknown_error(
5655
try:
5756
return handler(value)
5857
except Exception:
59-
return RiverUnknownError()
58+
return RiverUnknownError(code=ERROR_CODE_UNKNOWN, message="Unknown error")
6059

6160

6261
class Client(Generic[HandshakeMetadataType]):

src/replit_river/error_schema.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
# ERROR_CODE_CANCEL is the code used when either server or client cancels the stream.
1818
ERROR_CODE_CANCEL = "CANCEL"
1919

20+
# ERROR_CODE_UNKNOWN is the code for the RiverUnknownError
21+
ERROR_CODE_UNKNOWN = "UNKNOWN"
22+
2023

2124
class RiverError(BaseModel):
2225
"""Error message from the server."""

0 commit comments

Comments
 (0)