Skip to content

Commit

Permalink
Improve error handling in run
Browse files Browse the repository at this point in the history
  • Loading branch information
hannobraun committed May 25, 2022
1 parent 5db8a18 commit 3a2045e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crates/fj-viewer/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::{
camera::Camera,
graphics::{self, DrawConfig, Renderer},
input,
window::Window,
window::{self, Window},
};

/// Initializes a model viewer for a given model and enters its process loop.
Expand All @@ -27,7 +27,7 @@ pub fn run(
shape_processor: ShapeProcessor,
) -> Result<(), Error> {
let event_loop = EventLoop::new();
let window = Window::new(&event_loop).unwrap();
let window = Window::new(&event_loop)?;

let mut previous_time = Instant::now();

Expand Down Expand Up @@ -163,6 +163,10 @@ pub fn run(
/// Error in main loop
#[derive(Debug, thiserror::Error)]
pub enum Error {
/// Error initializing window
#[error("Error initializing window")]
WindowInit(#[from] window::Error),

/// Error initializing graphics
#[error("Error initializing graphics")]
GraphicsInit(#[from] graphics::InitError),
Expand Down

0 comments on commit 3a2045e

Please sign in to comment.