-
Notifications
You must be signed in to change notification settings - Fork 1.5k
wasi-http: Migrate to more descriptive error variant #7434
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
Merged
elliottt
merged 7 commits into
bytecodealliance:main
from
elliottt:trevor/wasi-http-errors
Nov 11, 2023
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
e90778f
Migrate to a more specific error-code variant in wasi-http
elliottt 045ebb2
Optional fields, and align with upstream pr
elliottt 620b993
Update for upstream changes to the error-code variant
elliottt c1b0290
Sync with the upstream implementation
elliottt 52a4455
Missed updating an error for riscv64 and s390x
elliottt ebabc9f
More debuggable error
elliottt 2c27580
Try to stabilize the test on windows
elliottt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 7 additions & 10 deletions
17
crates/test-programs/src/bin/http_outbound_request_invalid_version.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,14 @@ | ||
| use test_programs::wasi::http::types::{Method, Scheme}; | ||
| use test_programs::wasi::http::types::{ErrorCode, Method, Scheme}; | ||
|
|
||
| fn main() { | ||
| let addr = std::env::var("HTTP_SERVER").unwrap(); | ||
| let res = | ||
| test_programs::http::request(Method::Connect, Scheme::Http, &addr, "/", None, Some(&[])); | ||
|
|
||
| let error = res.unwrap_err().to_string(); | ||
| if !error.starts_with("Error::ProtocolError(\"") { | ||
| panic!( | ||
| r#"assertion failed: `(left == right)` | ||
| left: `"{error}"`, | ||
| right: `"Error::ProtocolError(\"invalid HTTP version parsed\")"` | ||
| or `"Error::ProtocolError(\"operation was canceled\")"`)"# | ||
| ) | ||
| } | ||
| assert!(matches!( | ||
| res.unwrap_err() | ||
| .downcast::<ErrorCode>() | ||
| .expect("expected a wasi-http ErrorCode"), | ||
| ErrorCode::HttpProtocolError, | ||
| )); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was preventing
downcast::<Error>()in test cases.