Make Http.TransportErr match host error behavior
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 121
- Forks
- 45
- Avg merge
- 18h 43m
- Merged PRs (30d)
- 10
Description
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
NetworkErrorand 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
- Every public
TransportErrvariant 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the public TransportErr declaration in platform/InternalHttp.roc:12 and the request error conversion in src/http.rs:167-170, then inspect the connection-refused integration scenario. Define and document the final mapping for each listed failure, update tests to assert variants, align documentation and examples, and include any API change in the release bump check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- api, cli, networking, release, testing
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100