throw exception when attempting to post query as goal (#329)

This commit is contained in:
Mark Thom
2020-04-12 12:07:41 -06:00
parent 97d8d07947
commit 5e81fb4754
3 changed files with 31 additions and 8 deletions

View File

@@ -289,7 +289,9 @@ impl fmt::Display for IndexingInstruction {
impl fmt::Display for SessionError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self {
&SessionError::CannotOverwriteBuiltIn(ref msg) => write!(f, "cannot overwrite {}", msg),
&SessionError::CannotOverwriteBuiltIn(ref msg) => {
write!(f, "cannot overwrite {}", msg)
}
&SessionError::CannotOverwriteImport(ref msg) => {
write!(f, "cannot overwrite import {}", msg)
}
@@ -312,7 +314,12 @@ impl fmt::Display for SessionError {
&SessionError::NamelessEntry => {
write!(f, "the predicate head is not an atom or clause.")
}
&SessionError::ParserError(ref e) => write!(f, "syntax_error({})", e.as_str()),
&SessionError::ParserError(ref e) => {
write!(f, "syntax_error({})", e.as_str())
}
&SessionError::QueryCannotBePostedAsGoal => {
write!(f, "query forms cannot be posted as goals.")
}
}
}
}