error handling lol

This commit is contained in:
galister
2024-02-19 03:30:16 +01:00
parent 5d812c3b09
commit 0eebc206a2
6 changed files with 37 additions and 34 deletions

View File

@@ -417,7 +417,7 @@ impl OverlayRenderer for ScreenRenderer {
let mut pipeline = None;
if mouse.is_some() {
let new_pipeline = self.pipeline.get_or_insert_with(|| {
let mut pipeline = ScreenPipeline::new(&self.extent, app).unwrap();
let mut pipeline = ScreenPipeline::new(&self.extent, app).unwrap(); // TODO
self.last_view = Some(pipeline.view.clone());
pipeline.ensure_mouse_initialized(&mut upload).unwrap(); // TODO
pipeline
@@ -430,7 +430,7 @@ impl OverlayRenderer for ScreenRenderer {
if let Some(pipeline) = pipeline {
pipeline.render(image, mouse.as_ref(), app)?;
} else {
let view = ImageView::new_default(image).unwrap();
let view = ImageView::new_default(image)?;
self.last_view = Some(view);
}
self.capture.request_new_frame();
@@ -459,6 +459,7 @@ impl OverlayRenderer for ScreenRenderer {
}
#[cfg(feature = "wayland")]
/// Panics if id is not a valid output id
fn try_create_screen<O>(
wl: &WlxClient,
id: u32,
@@ -468,7 +469,7 @@ fn try_create_screen<O>(
where
O: Default,
{
let output = &wl.outputs.get(id).unwrap();
let output = &wl.outputs.get(id).unwrap(); // safe due to contract
log::info!(
"{}: Res {}x{} Size {:?} Pos {:?}",
output.name,

View File

@@ -341,7 +341,7 @@ fn btn_func_dn(
func_right,
func_middle,
} = control.state.as_ref().unwrap()
// want to panic if state not found
// want panic
else {
log::error!("FuncButton state not found");
return;
@@ -403,7 +403,7 @@ fn battery_update(control: &mut Control<(), ElemState>, _: &mut (), app: &mut Ap
fg_color_low,
fg_color_charging,
} = control.state.as_ref().unwrap()
// want to panic if state not found
// want panic
else {
return;
};
@@ -449,7 +449,7 @@ fn exec_button(
ref mut child,
..
} = control.state.as_mut().unwrap()
// want to panic if state not found
// want panic
else {
log::error!("ExecButton state not found");
return;
@@ -490,7 +490,7 @@ fn exec_label_update(control: &mut Control<(), ElemState>, _: &mut (), _: &mut A
exec,
ref mut child,
} = control.state.as_mut().unwrap()
// want to panic if state not found
// want panic
else {
log::error!("AutoExec state not found");
return;
@@ -553,7 +553,7 @@ fn exec_label_update(control: &mut Control<(), ElemState>, _: &mut (), _: &mut A
}
fn clock_update(control: &mut Control<(), ElemState>, _: &mut (), _: &mut AppState) {
// want to panic if state not found
// want panic
let ElemState::Clock { timezone, format } = control.state.as_ref().unwrap() else {
log::error!("Clock state not found");
return;
@@ -574,7 +574,7 @@ fn overlay_button_scroll(
app: &mut AppState,
delta: f32,
) {
// want to panic if state not found
// want panic
let ElemState::OverlayButton { overlay, .. } = control.state.as_mut().unwrap() else {
log::error!("OverlayButton state not found");
return;
@@ -612,7 +612,7 @@ fn overlay_button_dn(
ref mut mode,
..
} = control.state.as_mut().unwrap()
// want to panic if state not found
// want panic
else {
log::error!("OverlayButton state not found");
return;
@@ -627,7 +627,7 @@ fn overlay_button_up(control: &mut Control<(), ElemState>, _: &mut (), app: &mut
mode,
overlay,
} = control.state.as_ref().unwrap()
// want to panic if state not found
// want panic
else {
log::error!("OverlayButton state not found");
return;