Merge branch 'develop' of github.com:Zokrates/ZoKrates into rc/0.7.2
This commit is contained in:
commit
b2cc60188f
2 changed files with 15 additions and 1 deletions
|
@ -150,7 +150,13 @@ impl fmt::Display for CompileErrorInner {
|
|||
write!(f, "{}\n\t{}", location, e.message())
|
||||
}
|
||||
CompileErrorInner::ReadError(ref e) => write!(f, "\n\t{}", e),
|
||||
CompileErrorInner::ImportError(ref e) => write!(f, "\n\t{}", e),
|
||||
CompileErrorInner::ImportError(ref e) => {
|
||||
let location = e
|
||||
.pos()
|
||||
.map(|p| format!("{}", p.0))
|
||||
.unwrap_or_else(|| "".to_string());
|
||||
write!(f, "{}\n\t{}", location, e.message())
|
||||
}
|
||||
CompileErrorInner::AnalysisError(ref e) => write!(f, "\n\t{}", e),
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,14 @@ impl Error {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn pos(&self) -> &Option<(Position, Position)> {
|
||||
&self.pos
|
||||
}
|
||||
|
||||
pub fn message(&self) -> &str {
|
||||
&self.message
|
||||
}
|
||||
|
||||
fn with_pos(self, pos: Option<(Position, Position)>) -> Error {
|
||||
Error { pos, ..self }
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue