use canvist_headless::HeadlessError;
use canvist_layout::LayoutError;
use canvist_paint::CpuError;
#[derive(Debug, thiserror::Error)]
pub enum DesktopError {
#[error(transparent)]
Headless(#[from] HeadlessError),
#[error(transparent)]
Layout(#[from] LayoutError),
#[error("the document belongs to another engine; create it with the editor's engine")]
ForeignDocument,
#[error(transparent)]
Render(#[from] CpuError),
#[cfg(feature = "winit")]
#[error("the GPU could not be set up: {0}")]
Gpu(String),
#[cfg(feature = "winit")]
#[error("the window could not be created: {0}")]
Window(#[from] winit::error::OsError),
#[cfg(feature = "winit")]
#[error("the event loop failed: {0}")]
EventLoop(#[from] winit::error::EventLoopError),
}
pub type DesktopResult<T> = Result<T, DesktopError>;