Context
InternalHttp.TransportErr declares:
[Timeout, NetworkError, BadBody, Other(List(U8))]
in platform/InternalHttp.roc:12.
The Rust host constructs Timeout, BadBody, and Other, but never constructs NetworkError. Every error returned by client.request(request).await is converted to Other(err.to_string().as_bytes()) at src/http.rs:167-170.
The connection-refused integration scenario currently demonstrates this behavior: it produces HttpErr(Other(... "client error (Connect)" ...)).
This is related to #142, which was closed because error details are now retained in Other. The remaining problem is that the public union still advertises an unreachable NetworkError variant.
Suggested direction
Choose and document one consistent contract:
- classify DNS/connect/TLS/socket failures as
NetworkError(details), potentially changing its payload; or
- remove
NetworkError and define when Other is used.
Prefer stable structured categories over matching Hyper's display strings. Preserve useful diagnostic details without making callers parse text to identify ordinary network failures.
Acceptance criteria
- Every public
TransportErr variant has a documented, reachable meaning, or unreachable variants are removed.
- Connection refused, DNS failure, TLS failure, timeout, invalid response body, and request-construction failure are mapped intentionally.
- Tests assert error variants, not only that an HTTP request failed.
- Documentation and examples reflect the final error shape.
- Any API change is included in the release bump check.
Context
InternalHttp.TransportErrdeclares:in
platform/InternalHttp.roc:12.The Rust host constructs
Timeout,BadBody, andOther, but never constructsNetworkError. Every error returned byclient.request(request).awaitis converted toOther(err.to_string().as_bytes())atsrc/http.rs:167-170.The connection-refused integration scenario currently demonstrates this behavior: it produces
HttpErr(Other(... "client error (Connect)" ...)).This is related to #142, which was closed because error details are now retained in
Other. The remaining problem is that the public union still advertises an unreachableNetworkErrorvariant.Suggested direction
Choose and document one consistent contract:
NetworkError(details), potentially changing its payload; orNetworkErrorand define whenOtheris used.Prefer stable structured categories over matching Hyper's display strings. Preserve useful diagnostic details without making callers parse text to identify ordinary network failures.
Acceptance criteria
TransportErrvariant has a documented, reachable meaning, or unreachable variants are removed.