1
0
Fork 0
mirror of https://github.com/Zedfrigg/ironbar.git synced 2025-07-02 03:01:04 +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,5 +1,6 @@
use crate::config::CommonConfig;
use crate::dynamic_string::DynamicString;
use crate::error as err;
use crate::modules::{Module, ModuleInfo, ModuleUpdateEvent, ModuleWidget, WidgetContext};
use crate::popup::{ButtonGeometry, Popup};
use crate::script::Script;
@ -119,8 +120,6 @@ impl Widget {
}
label
// DynamicString::new(label, &text)
}
/// Creates a `gtk::Button` from this widget
@ -150,7 +149,7 @@ impl Widget {
cmd: exec.clone(),
geometry: Popup::button_pos(button, bar_orientation),
})
.expect("Failed to send exec message");
.expect(err::ERR_CHANNEL_SEND);
});
}
@ -191,15 +190,15 @@ impl Module<gtk::Box> for CustomModule {
} else if event.cmd == "popup:toggle" {
tx.send(ModuleUpdateEvent::TogglePopup(event.geometry))
.await
.expect("Failed to send open popup event");
.expect(err::ERR_CHANNEL_SEND);
} else if event.cmd == "popup:open" {
tx.send(ModuleUpdateEvent::OpenPopup(event.geometry))
.await
.expect("Failed to send open popup event");
.expect(err::ERR_CHANNEL_SEND);
} else if event.cmd == "popup:close" {
tx.send(ModuleUpdateEvent::ClosePopup)
.await
.expect("Failed to send open popup event");
.expect(err::ERR_CHANNEL_SEND);
} else {
error!("Received invalid command: '{}'", event.cmd);
}