diff options
author | Kjetil Orbekk <kj@orbekk.com> | 2022-11-26 13:21:33 -0500 |
---|---|---|
committer | Kjetil Orbekk <kj@orbekk.com> | 2022-11-27 17:23:11 -0500 |
commit | 8fe6b9755a9c96246e7aa1158ee02becda79aa68 (patch) | |
tree | 536105893e893c0af76ffd10778060d49fb62674 /webapp/src/components/table.rs | |
parent | 685ac902e3faf4ed5a76b8c859b01f7d2e2d9ea0 (diff) |
Improve error reporting when server requests fail
Diffstat (limited to 'webapp/src/components/table.rs')
-rw-r--r-- | webapp/src/components/table.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/webapp/src/components/table.rs b/webapp/src/components/table.rs index c4f693e..a874a93 100644 --- a/webapp/src/components/table.rs +++ b/webapp/src/components/table.rs @@ -4,6 +4,8 @@ use protocol::bridge_engine::GameStatePlayerView; use yew::prelude::*; use crate::use_app_context; use crate::components::Hand; +use crate::utils::ok_json; +use anyhow::Context; #[function_component(OnlineTable)] pub fn online_table(props: &OnlineTableProps) -> Html { @@ -20,9 +22,8 @@ pub fn online_table(props: &OnlineTableProps) -> Html { ctx.spawn_async(async move { let response = Request::get(&format!("/api/table/{}", props.table.id)) .send() - .await?; - // info!("Got response: {:#?}", response.body()); - let table = response.json().await?; + .await.context("fetching table data")?; + let table = ok_json(response).await?; table_state.set(Some(table)); Ok(()) }); |