From: Dominik Csapak <d.csapak@proxmox.com>
To: yew-devel@lists.proxmox.com
Subject: [yew-devel] [PATCH yew-comp 1/3] http client: include canonical http error with status code
Date: Wed, 8 Jan 2025 14:23:05 +0100 [thread overview]
Message-ID: <20250108132307.2195787-1-d.csapak@proxmox.com> (raw)
e.g. when receiving a 401 error, this will change from
'HTTP status 401' to
'HTTP status 401 Unauthorized'
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
src/http_client_wasm.rs | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/http_client_wasm.rs b/src/http_client_wasm.rs
index 7f02164..3e5b187 100644
--- a/src/http_client_wasm.rs
+++ b/src/http_client_wasm.rs
@@ -205,7 +205,8 @@ impl HttpClientWasm {
web_sys_response_to_http_api_response(self.fetch_request(request, None).await?).await?;
if !(response.status >= 200 && response.status < 300) {
- bail!("HTTP status {}", response.status);
+ let status = http::StatusCode::from_u16(response.status)?;
+ bail!("HTTP status {status}");
}
let text = String::from_utf8(response.body)?;
--
2.39.5
_______________________________________________
yew-devel mailing list
yew-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/yew-devel
next reply other threads:[~2025-01-08 13:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-08 13:23 Dominik Csapak [this message]
2025-01-08 13:23 ` [yew-devel] [PATCH yew-comp 2/3] login panel: improve message on login error Dominik Csapak
2025-01-08 13:23 ` [yew-devel] [PATCH yew-comp 3/3] login panel: improve layout Dominik Csapak
2025-01-08 13:36 ` [yew-devel] applied: [PATCH yew-comp 1/3] http client: include canonical http error with status code Dietmar Maurer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250108132307.2195787-1-d.csapak@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=yew-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox