Expand description
One taxonomy for everything that can go wrong between a named operation and a decoded response.
§Why one enum and not one per surface
The sealed contract surface and the discovered cassette surface used to carry an error type each, and the two disagreed in ways nothing checked: a non-success status was a rich variant on one side and absent from the other, a URL failure had two spellings, and “could not decode” meant the bytes are not JSON in one crate and the JSON is not the requested type in the other. A consumer wrapping both got two vocabularies for one API and had to decide, per variant, whether the difference was meaningful. It never was.
The variants below are grouped by the four things that actually happen:
- Contract — a refusal. The operation, parameter, or body a caller named disagrees with the document, and nothing is sent. These are build defects at the call site, which is why they are loud and name the offender.
- Transport — the request could not be delivered or the client could not
be built. Carries a
TransportError, which is deliberately opaque: the seam admits implementations that have never heard of HTTP. - ApiStatus — the request arrived and the server refused it. The body travels with the status because every tapes error body names the offending parameter, and the bare status never does.
- Decode — the bytes came back and are not what was asked for.
This enum is #[non_exhaustive]: it is the shared vocabulary of a growing
surface, and a consumer that matches it must say what it does with a
condition its build predates rather than fail to compile when one appears.
Enums§
- Error
- Anything that can go wrong driving a tapes API call.
Type Aliases§
- Result
- This crate’s result alias.