1use std::{error::Error, fmt};
2
3#[derive(Debug)]
4pub struct PlatformError(winit::error::EventLoopError);
5
6impl fmt::Display for PlatformError {
7 fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
8 write!(formatter, "platform error: {}", self.0)
9 }
10}
11
12impl Error for PlatformError {
13 fn source(&self) -> Option<&(dyn Error + 'static)> {
14 Some(&self.0)
15 }
16}
17
18impl From<winit::error::EventLoopError> for PlatformError {
19 fn from(error: winit::error::EventLoopError) -> Self {
20 Self(error)
21 }
22}
23
24impl From<winit::error::OsError> for PlatformError {
25 fn from(error: winit::error::OsError) -> Self {
26 Self(error.into())
27 }
28}