Rendering spans

This commit is contained in:
Tom Alexander
2020-04-11 18:25:48 -04:00
parent 13934e8699
commit 2459d7b418
6 changed files with 114 additions and 21 deletions

48
src/renderer/errors.rs Normal file
View File

@@ -0,0 +1,48 @@
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
}
}