all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [yew-devel] [PATCH yew-comp 1/3] http client: include canonical http error with status code
@ 2025-01-08 13:23 Dominik Csapak
  2025-01-08 13:23 ` [yew-devel] [PATCH yew-comp 2/3] login panel: improve message on login error Dominik Csapak
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dominik Csapak @ 2025-01-08 13:23 UTC (permalink / raw)
  To: yew-devel

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-01-08 13:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-08 13:23 [yew-devel] [PATCH yew-comp 1/3] http client: include canonical http error with status code Dominik Csapak
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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal