Implement Error for CompilerError (#181)

This commit is contained in:
Mackenzie Clark
2019-02-14 21:08:35 -08:00
committed by GitHub
parent 09ba27390c
commit 39ef47ebb1

View File

@ -28,6 +28,19 @@ impl PartialEq for CompileError {
}
}
impl std::fmt::Display for CompileError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match self {
CompileError::InternalError { msg } => {
write!(f, "Internal compiler error: \"{}\"", msg)
}
CompileError::ValidationError { msg } => write!(f, "Validation error \"{}\"", msg),
}
}
}
impl std::error::Error for CompileError {}
/// This is returned when the runtime is unable to
/// correctly link the module with the provided imports.
///