#[cfg(all(feature = "rendering", target_os = "linux"))]
use std::time::Duration;
#[cfg(all(feature = "rendering", target_os = "linux"))]
use crate::overlay::ApplyError;
#[derive(thiserror::Error, Debug)]
pub enum StyleError {
#[cfg(all(feature = "rendering", target_os = "linux"))]
#[error(transparent)]
IoError(#[from] std::io::Error),
#[cfg(all(feature = "rendering", target_os = "linux"))]
#[error("Failed to load style: {message}")]
StyleLoadError {
message: String,
},
#[cfg(all(feature = "rendering", target_os = "linux"))]
#[error(transparent)]
RenderingError(#[from] maplibre_native_ffi::Error),
#[cfg(all(feature = "rendering", target_os = "linux"))]
#[error("MapLibre did not answer within {timeout:?}: {call}")]
Timeout {
call: &'static str,
timeout: Duration,
},
#[cfg(all(feature = "rendering", target_os = "linux"))]
#[error("No graphics device can render styles: {reason}")]
GraphicsUnavailable {
reason: String,
},
#[cfg(all(feature = "rendering", target_os = "linux"))]
#[error(transparent)]
OverlayApply(#[from] ApplyError),
#[cfg(all(feature = "rendering", target_os = "linux"))]
#[error("Failed to send request to rendering thread")]
FailedToSendRequest,
#[cfg(all(feature = "rendering", target_os = "linux"))]
#[error("Failed to receive response from rendering thread")]
FailedToReceiveResponse,
#[cfg(all(feature = "rendering", target_os = "linux"))]
#[error("Rendering thread panicked while handling the request")]
RenderingPanicked,
#[cfg(all(feature = "rendering", target_os = "linux"))]
#[error("Rendering is disabled")]
RenderingIsDisabled,
}