Pre: Generalize NonNumericArgument to InvalidArgument.

This commit is contained in:
Nick Alexander 2017-04-26 15:31:09 -07:00 committed by Richard Newman
parent 2f38f1e73e
commit 4d2eb7222e
2 changed files with 4 additions and 3 deletions

View file

@ -59,7 +59,7 @@ impl ConjoiningClauses {
Constant(NonIntegerConstant::BigInteger(_)) | Constant(NonIntegerConstant::BigInteger(_)) |
Vector(_) => { Vector(_) => {
self.mark_known_empty(EmptyBecause::NonNumericArgument); self.mark_known_empty(EmptyBecause::NonNumericArgument);
bail!(ErrorKind::NonNumericArgument(function.clone(), position)); bail!(ErrorKind::InvalidArgument(function.clone(), "numeric", position));
}, },
Constant(NonIntegerConstant::Float(f)) => Ok(QueryValue::TypedValue(TypedValue::Double(f))), Constant(NonIntegerConstant::Float(f)) => Ok(QueryValue::TypedValue(TypedValue::Double(f))),
} }

View file

@ -42,9 +42,10 @@ error_chain! {
display("unbound variable: {}", name) display("unbound variable: {}", name)
} }
NonNumericArgument(function: PlainSymbol, position: usize) {
InvalidArgument(function: PlainSymbol, expected_type: &'static str, position: usize) {
description("invalid argument") description("invalid argument")
display("invalid argument to {}: expected numeric in position {}.", function, position) display("invalid argument to {}: expected {} in position {}.", function, expected_type, position)
} }
InvalidLimit(val: String, kind: ValueType) { InvalidLimit(val: String, kind: ValueType) {