elliottt opened PR #7534 from elliottt:trevor/error-code-follow-up
to bytecodealliance:main
:
Implement the body of
http-error-code
, and add a test that shows its use when writing too much. This functionality was missing from #7434.Additionally, add some functions in wasi-http for converting from hyper::Error and http::Error to the new
ErrorCode
variant. These functions log the error received as a warning, and return the translated error to the guest.<!--
Please make sure you include the following information:
If this work has been discussed elsewhere, please include a link to that
conversation. If it was discussed in an issue, just mention "issue #...".Explain why this change is needed. If the details are in an issue already,
this can be brief.Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.htmlPlease ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->
elliottt requested fitzgen for a review on PR #7534.
elliottt requested wasmtime-core-reviewers for a review on PR #7534.
elliottt requested alexcrichton for a review on PR #7534.
elliottt requested pchickey for a review on PR #7534.
elliottt updated PR #7534.
alexcrichton submitted PR review.
alexcrichton submitted PR review.
alexcrichton created PR review comment:
I realize that this matches what I was talking about yesterday, where if an error is dropped on the floor it's always at least logged, but I will also say that there's quite a lot of logging going on here. In theory almost all error context should be made available to end users, but it seems like almost all errors are being dropped and canonicalized in bland error codes.
There's not really anything that can be done about that in this PR specifically, but it might be something good to keep in mind for future iterations of wasi-http. One possible example might be something like a "last error as debug string" API or something like that. Or alternatively using
wasi:io/error.{error}
for all http APIs and then having an optional "pull out the http-specific error kind from each error" API sort of like filesystems. Too late to do this for preview2 but perhaps later.
elliottt updated PR #7534.
elliottt updated PR #7534.
elliottt submitted PR review.
elliottt created PR review comment:
This was going to be a bit noisy, so I've reworked it so that we only log on a path where there's not clear translation back to a wasi-http error (the fall-through cases). Looking more towards the future, I wonder if it would be better to return a
wasi:io/error/error
instead of awasi:http/types/error-code
. @pchickey and I started working on this last week, but held off on making this change as it was not as easy as swapping out uses oferror-code
.
elliottt updated PR #7534.
elliottt merged PR #7534.
Last updated: Dec 23 2024 at 12:05 UTC