Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Box event loop error variants #1539

Merged
merged 2 commits into from
Jan 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions crates/fj-window/src/event_loop_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl EventLoopHandler {
event: Event<ModelEvent>,
control_flow: &mut ControlFlow,
) -> Result<(), Error> {
// Trigger a panic if the host thead has panicked.
// Trigger a panic if the host thread has panicked.
self.host.propagate_panic();

if let Event::WindowEvent { event, .. } = &event {
Expand Down Expand Up @@ -91,7 +91,7 @@ impl EventLoopHandler {
}

ModelEvent::Error(err) => {
return Err(err.into());
return Err(Box::new(err).into());
}
},
Event::WindowEvent {
Expand Down Expand Up @@ -184,8 +184,8 @@ impl EventLoopHandler {
gui_state,
);
if let Some(model_path) = new_model_path {
let model =
Model::new(model_path, Parameters::empty())?;
let model = Model::new(model_path, Parameters::empty())
.map_err(Box::new)?;
self.host.load_model(model);
}
}
Expand Down Expand Up @@ -262,10 +262,10 @@ fn input_event<T>(
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("Host error")]
Host(#[from] fj_host::Error),
Host(#[from] Box<fj_host::Error>),

#[error("Shape processing error")]
ShapeProcessor(#[from] shape_processor::Error),
ShapeProcessor(#[from] Box<shape_processor::Error>),
}

/// Affects the speed of zoom movement given a scroll wheel input in lines.
Expand Down