zenith_render/error.rs
1//! Error type for the render crate.
2
3/// An error produced by the rasterization or encoding pipeline.
4#[derive(Debug, Clone, PartialEq)]
5pub struct RenderError {
6 /// Human-readable description of what went wrong.
7 pub message: String,
8}
9
10impl RenderError {
11 /// Construct a `RenderError` with the given message.
12 pub fn new(message: impl Into<String>) -> Self {
13 Self {
14 message: message.into(),
15 }
16 }
17}
18
19impl std::fmt::Display for RenderError {
20 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
21 write!(f, "{}", self.message)
22 }
23}
24
25impl std::error::Error for RenderError {}