use std::error::Error; use raw_window_handle::{HasRawWindowHandle, RawWindowHandle}; use thiserror::Error; #[derive(Error, Debug)] pub enum SoftBufferError { #[error( "The provided window returned an unsupported platform: {human_readable_platform_name}." )] UnsupportedPlatform { window: W, human_readable_platform_name: &'static str, handle: RawWindowHandle, }, #[error("Platform error")] PlatformError(Option, Option>) } #[allow(unused)] // This isn't used on all platforms pub(crate) fn unwrap(res: Result, str: &str) -> Result>{ match res{ Ok(t) => Ok(t), Err(e) => Err(SoftBufferError::PlatformError(Some(str.into()), Some(Box::new(e)))) } }