Skip to content

Commit 2016e49

Browse files
committed
decoders: document the DecodeError seam wrap on ResponseDecoder
One-sentence addition: implementers can raise whatever their backing library raises; Client.send / AsyncClient.send translate to httpware.DecodeError at the seam.
1 parent 7c89dbd commit 2016e49

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎src/httpware/decoders/__init__.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@ class ResponseDecoder(Protocol):
1111
"""Structural protocol every response-body decoder satisfies."""
1212

1313
def decode(self, content: bytes, model: type[T]) -> T:
14-
"""Decode `content` (raw response bytes) into an instance of `model`."""
14+
"""Decode `content` (raw response bytes) into an instance of `model`.
15+
16+
Any exception raised by `decode` is wrapped by `Client.send` /
17+
`AsyncClient.send` into `httpware.DecodeError`; implementers do not
18+
need to raise `DecodeError` directly.
19+
"""
1520
...
1621

1722

0 commit comments

Comments
 (0)