diff options
author | Ben Bridle <ben@derelict.engineering> | 2025-08-21 14:34:40 +1200 |
---|---|---|
committer | Ben Bridle <ben@derelict.engineering> | 2025-08-21 14:42:51 +1200 |
commit | 2f162164d44a41d95cbea19c1dcaf22ae21f2b64 (patch) | |
tree | ceb291db11def6d2df6c9403d9b0c97d19269955 /src | |
parent | 62fd7d9cf17bb3510396be54e23babb545d8c7ed (diff) | |
download | phosphor-2f162164d44a41d95cbea19c1dcaf22ae21f2b64.zip |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/phosphor.rs | 8 |
1 files 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<Self, ()> { - if let Ok(event_loop) = EventLoop::new() { + pub fn new() -> Result<Self, EventLoopError> { + EventLoop::new().and_then(|event_loop| { Ok( Self { event_loop, builders: Vec::new() } ) - } else { - Err(()) - } + }) } pub fn add_window(&mut self, window: WindowBuilder) { |