Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log ToolchainError with response contents #435

Merged
merged 1 commit into from
May 17, 2024

Conversation

omochi
Copy link
Contributor

@omochi omochi commented May 17, 2024

課題

GitHub APIにアクセスして失敗した時、そのレスポンスがログに出力されないため、
以下のように CI でそれが起きた時、問題の詳細が分からず修正が困難です。

https://github.com/swiftwasm/carton/actions/runs/9120974490/job/25079364661?pr=434#step:8:413

提案

ToolchainError に レスポンスボディを含めるようにして、ログに出します。

確認

手元では以下のように出力が得られました。
URL をわざと間違えています。

Response from https://api.github.com/repos/swiftwasm/swiftxx/releases/tags/swift-wasm-5.9.2-RELEASE had invalid status 404 with a body of 118 bytes: {"message":"Not Found","documentation_url":"https://docs.github.com/rest/releases/releases#get-a-release-by-tag-name"}

case let .invalidResponse(url: url, status: status):
return "Response from \(url) had invalid status \(status) or didn't contain body"
case let .notHTTPURLResponse(url: url):
return "Response from \(url) is not HTTPURLResponse"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

異なる状況で invalidResponse を併用しているのがわかりづらかったので別のエラーに分離しました。

@kateinoigakukun kateinoigakukun added the bug Something isn't working label May 17, 2024
@kateinoigakukun kateinoigakukun merged commit 1b896c2 into swiftwasm:main May 17, 2024
2 of 4 checks passed
@omochi omochi deleted the toolchain-error-body branch May 17, 2024 01:45
@kateinoigakukun kateinoigakukun changed the title ToolchainErrorにレスポンスの内容も含めてログに出す Log ToolchainError including response contents May 19, 2024
@kateinoigakukun kateinoigakukun changed the title Log ToolchainError including response contents Log ToolchainError with response contents May 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants