1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-07-04 04:01:03 +02:00

refactor: standardise error messages

This commit is contained in:
Jake Stanger 2022-12-11 21:31:45 +00:00
parent fd2d7e5c7a
commit 9d5049dde0
No known key found for this signature in database
GPG key ID: C51FC8F9CB0BEA61
19 changed files with 117 additions and 110 deletions

View file

@ -1,7 +1,7 @@
use crate::await_sync;
use crate::clients::sway::{get_client, get_sub_client};
use crate::config::CommonConfig;
use crate::modules::{Module, ModuleInfo, ModuleUpdateEvent, ModuleWidget, WidgetContext};
use crate::{await_sync, error};
use color_eyre::{Report, Result};
use gtk::prelude::*;
use gtk::Button;
@ -53,8 +53,7 @@ fn create_button(
let tx = tx.clone();
let name = name.to_string();
button.connect_clicked(move |_item| {
tx.try_send(name.clone())
.expect("Failed to send workspace click event");
tx.try_send(name.clone()).expect(error::ERR_CHANNEL_SEND);
});
}
@ -95,7 +94,7 @@ impl Module<gtk::Box> for WorkspacesModule {
};
tx.try_send(ModuleUpdateEvent::Update(WorkspaceUpdate::Init(workspaces)))
.expect("Failed to send initial workspace list");
.expect(error::ERR_CHANNEL_SEND);
// Subscribe & send events
spawn(async move {
@ -109,7 +108,7 @@ impl Module<gtk::Box> for WorkspacesModule {
while let Ok(payload) = srx.recv().await {
tx.send(ModuleUpdateEvent::Update(WorkspaceUpdate::Update(payload)))
.await
.expect("Failed to send workspace update");
.expect(error::ERR_CHANNEL_SEND);
}
});