# error.rs - source
Source of the Rust file `maplibre/src/render/error.rs`.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23

    use thiserror::Error;

    use crate::render::graph::RenderGraphError;

    #[derive(Error, Debug)]
    pub enum RenderError {
        #[error("error in surface")]
        Surface(#[from] wgpu::SurfaceError),
        #[error("error during surface creation")]
        CreateSurfaceError(#[from] wgpu::CreateSurfaceError),
        #[error("error in render graph")]
        Graph(#[from] RenderGraphError),
        #[error("error while requesting device")]
        RequestDevice(#[from] wgpu::RequestDeviceError),
        #[error("error while requesting adaptor")]
        RequestAdaptor,
    }

    impl RenderError {
        pub fn should_exit(&self) -> bool {
            matches!(self, RenderError::Surface(wgpu::SurfaceError::OutOfMemory))
        }
    }