21 lines
408 B
Rust
21 lines
408 B
Rust
use crate::location::Location;
|
|
use std::error::Error;
|
|
use std::fmt;
|
|
|
|
#[derive(Debug)]
|
|
pub struct CompileError {
|
|
message: String,
|
|
location: Location,
|
|
}
|
|
|
|
impl fmt::Display for CompileError {
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
write!(f, "Compile Error: {:?}", self)
|
|
}
|
|
}
|
|
|
|
impl Error for CompileError {
|
|
fn description(&self) -> &str {
|
|
&self.message
|
|
}
|
|
}
|