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

MNEMONIC-803: Enhanced Rust HTTP Client Code with Improved Error Hand… #363

Merged
merged 1 commit into from
Dec 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion mnemonic-protocol/client/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
// specific language governing permissions and limitations
// under the License.

// Import necessary libraries
use reqwest;

// Main asynchronous function
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
// The URL of the server you want to visit
Expand All @@ -32,8 +34,16 @@ async fn main() -> Result<(), reqwest::Error> {
println!("Response body:\n{}", body);
} else {
// Print the status code and reason phrase for unsuccessful requests
println!("Request failed with status: {} - {}", response.status(), response.status().canonical_reason().unwrap_or("Unknown"));
println!(
"Request failed with status: {} - {}",
response.status(),
response
.status()
.canonical_reason()
.unwrap_or("Unknown")
);
}

// Return Ok to indicate success
Ok(())
}
Loading