From 2f162164d44a41d95cbea19c1dcaf22ae21f2b64 Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Thu, 21 Aug 2025 14:34:40 +1200 Subject: Return EventLoopError if Phosphor could not be initialised The function was previously throwing away the error and returning the unit type, preventing the caller from debugging the issue further. --- src/phosphor.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/phosphor.rs b/src/phosphor.rs index 122f36f..22f9de5 100644 --- a/src/phosphor.rs +++ b/src/phosphor.rs @@ -19,12 +19,10 @@ pub struct Phosphor { } impl Phosphor { - pub fn new() -> Result { - if let Ok(event_loop) = EventLoop::new() { + pub fn new() -> Result { + EventLoop::new().and_then(|event_loop| { Ok( Self { event_loop, builders: Vec::new() } ) - } else { - Err(()) - } + }) } pub fn add_window(&mut self, window: WindowBuilder) { -- cgit v1.2.3-70-g09d2