duster/src/renderer/errors.rs

49 lines
1.0 KiB
Rust
Raw Normal View History

2020-04-11 18:25:48 -04:00
use std::error;
use std::fmt;
#[derive(Clone)]
pub struct RenderError {
pub message: String,
}
#[derive(Clone)]
pub struct CompileError {
pub message: String,
}
impl fmt::Display for RenderError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Error rendering: {}", self.message)
}
}
impl fmt::Debug for RenderError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Error rendering: {}", self.message)
}
}
impl error::Error for RenderError {
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
None
}
}
impl fmt::Display for CompileError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Error rendering: {}", self.message)
}
}
impl fmt::Debug for CompileError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Error rendering: {}", self.message)
}
}
impl error::Error for CompileError {
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
None
}
}