Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Make Http.TransportErr match host error behavior

未關閉
#438 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
45/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
冷清
技術堆疊
rust

研究方向

從 platform/InternalHttp.roc:12 中公開的 TransportErr 宣告和 src/http.rs:167-170 中的請求錯誤轉換開始,接著檢查連線遭拒的整合情境。為列出的每個失敗定義並記錄最終對應,更新測試以斷言各個變體,使文件和範例保持一致,並將任何 API 變更納入 release bump 檢查。

由索引模型根據 Issue 內容生成。

描述

bug

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:

  1. classify DNS/connect/TLS/socket failures as NetworkError(details), potentially changing its payload; or
  2. 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.
主要語言
Rust
星號
121
分支
45
平均合併
19 小時 1 分鐘
30 天內合併 PR
16

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

roc-lang/basic-cli 的其他 Issue

查看 roc-lang/basic-cli 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。