1
0
Fork 0
mirror of synced 2025-09-24 04:40:05 +00:00

Merge branch 'develop' of github.com:Zokrates/ZoKrates into rc/0.7.2

This commit is contained in:
schaeff 2021-05-18 11:26:31 +02:00
commit b2cc60188f
2 changed files with 15 additions and 1 deletions

View file

@ -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),
}
}

View file

@ -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 }
}