#[derive(Debug)]
pub enum Error {
WaylandConnectError(wayland_client::ConnectError),
WaylandDispatchError(wayland_client::DispatchError),
WaylandSurfaceConfigurationError,
WaylandLayerShellError,
WaylandSurfacePtrNull,
WaylandDisplayPtrNull,
GlutinError(glutin::error::Error),
GlutinDisplayNull,
NoFontConfig,
FontConfigError(fontconfig::FontconfigError),
ZeroWindowHeight,
ZeroWindowWidth,
ZeroSwapInterval,
WaylandFrameCallbackError,
BeamTermError(beamterm_core::Error),
}
impl std::error::Error for Error {}
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match &self {
Self::WaylandConnectError(e) => write!(f, "{}", e),
Self::WaylandDispatchError(e) => write!(f, "{}", e),
Self::WaylandSurfaceConfigurationError => write!(f, "wayland surface not configured"),
Self::WaylandSurfacePtrNull => write!(f, "wayland surface pointer is null"),
Self::WaylandDisplayPtrNull => write!(f, "wayland display pointer is null"),
Self::GlutinError(e) => write!(f, "{}", e),
Self::GlutinDisplayNull => write!(f, "glutin display is null"),
Self::ZeroWindowHeight => write!(f, "window height is zero"),
Self::ZeroWindowWidth => write!(f, "window width is zero"),
Self::ZeroSwapInterval => write!(f, "swap interval is zero"),
Self::WaylandFrameCallbackError => {
write!(f, "unable to set wayland frame callback, surface dropped?")
}
Self::BeamTermError(e) => write!(f, "{}", e),
Self::NoFontConfig => write!(f,"no font config"),
Self::FontConfigError(e) => write!(f, "{}", e),
Self::WaylandLayerShellError => write!(f, "Wayland layer shell error"),
}
}
}