diff options
author | Paweł Dybiec <pawel@dybiec.info> | 2024-11-11 22:56:20 +0000 |
---|---|---|
committer | Paweł Dybiec <pawel@dybiec.info> | 2024-11-11 22:56:20 +0000 |
commit | 2874e6f98abad8448bda5c4229293f1eb857b76c (patch) | |
tree | 2637a2c600f7f1c70688c036f1c81d348aa31d59 /src/mattermost | |
parent | Cleanup flake, update deps (diff) |
Fix panic when closingmain
Diffstat (limited to 'src/mattermost')
-rw-r--r-- | src/mattermost/client.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mattermost/client.rs b/src/mattermost/client.rs index 861e0a8..2172338 100644 --- a/src/mattermost/client.rs +++ b/src/mattermost/client.rs @@ -15,6 +15,11 @@ pub struct Client { bearer_token: Option<String>, client: reqwest::Client, } +impl std::fmt::Debug for Client { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("Client").field("url", &self.url).finish() + } +} #[async_trait::async_trait] pub trait Handler { @@ -26,10 +31,10 @@ pub trait Handler { } impl Client { - pub(crate) fn new(auth: AuthData, url: &str) -> Self { + pub(crate) fn new(auth: AuthData, url: String) -> Self { Self { auth, - url: url.to_owned(), + url, bearer_token: None, client: reqwest::Client::new(), } @@ -90,6 +95,7 @@ impl Client { match json { Ok(websocketmessage) => { if let WebsocketMessage::Update(update) = websocketmessage { + debug!("Handling update {:?}", update); if let Err(err) = handler.handle(update, &self).await { warn!("Handler returned error: {err}"); } |