#[cfg(all(
feature = "renderer-wgpu",
any(feature = "desktop-shell", all(feature = "ios", target_os = "ios"))
))]
use thiserror::Error;
#[cfg(all(
feature = "renderer-wgpu",
any(feature = "desktop-shell", all(feature = "ios", target_os = "ios"))
))]
#[derive(Debug, Error)]
pub enum LaunchError {
#[cfg(feature = "embed")]
#[error("embedded launch failed: {0}")]
Embedded(#[from] crate::embed::EmbedError),
#[error("failed to create desktop event loop: {0}")]
EventLoopCreate(#[source] winit::error::EventLoopError),
#[error("failed to create desktop window: {0}")]
WindowCreate(#[source] winit::error::CreateWindowError),
#[cfg(feature = "renderer-wgpu")]
#[error("failed to create desktop rendering surface: {0}")]
SurfaceCreate(#[source] wgpu::CreateSurfaceError),
#[error("desktop rendering surface reports no supported formats")]
NoSurfaceFormat,
#[error("desktop rendering surface reports no supported alpha modes")]
NoSurfaceAlphaMode,
#[cfg(feature = "renderer-wgpu")]
#[error("no compatible GPU adapter was available: {0}")]
NoAdapter(#[source] wgpu::RequestAdapterError),
#[cfg(feature = "renderer-wgpu")]
#[error("failed to create GPU device: {0}")]
DeviceCreate(#[source] wgpu::RequestDeviceError),
#[error("desktop GPU context is not initialized")]
GpuContextUnavailable,
#[error("the GPU device was lost and could not be replaced")]
GpuDeviceLost,
#[error("desktop application content is unavailable during launch")]
ContentUnavailable,
#[error("desktop event loop terminated with error: {0}")]
EventLoopRun(#[source] winit::error::EventLoopError),
#[cfg(feature = "robot")]
#[error("desktop robot test driver panicked: {0}")]
TestDriverPanic(String),
}
#[cfg(all(
feature = "renderer-wgpu",
any(feature = "desktop-shell", feature = "ios")
))]
#[expect(clippy::print_stderr, reason = "a failed launch is reported")]
pub(crate) fn exit_after_launch_error(context: &str, error: &LaunchError) -> ! {
eprintln!("{context}: {error}");
std::process::exit(1)
}