mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-04-25 01:58:39 +02:00
Better invalid URL errors
This commit is contained in:
@@ -89,14 +89,24 @@ pub async fn send_http_request(
|
|||||||
let uri = match http::Uri::from_str(url_string.as_str()) {
|
let uri = match http::Uri::from_str(url_string.as_str()) {
|
||||||
Ok(u) => u,
|
Ok(u) => u,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
return response_err(response, e.to_string(), window).await;
|
return response_err(
|
||||||
|
response,
|
||||||
|
format!("Failed to parse URL \"{}\": {}", url_string, e.to_string()),
|
||||||
|
window,
|
||||||
|
)
|
||||||
|
.await;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
// Yes, we're parsing both URI and URL because they could return different errors
|
// Yes, we're parsing both URI and URL because they could return different errors
|
||||||
let url = match Url::from_str(uri.to_string().as_str()) {
|
let url = match Url::from_str(uri.to_string().as_str()) {
|
||||||
Ok(u) => u,
|
Ok(u) => u,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
return response_err(response, e.to_string(), window).await;
|
return response_err(
|
||||||
|
response,
|
||||||
|
format!("Failed to parse URL \"{}\": {}", url_string, e.to_string()),
|
||||||
|
window,
|
||||||
|
)
|
||||||
|
.await;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user