mentat/query-algebrizer/src/errors.rs
Richard Newman a5023c70cb Use Rc for TypedValue, Variable, and query Ident keywords. (#395) r=nalexander
Part 1, core: use Rc for String and Keyword.
Part 2, query: use Rc for Variable.
Part 3, sql: use Rc for args in SQLiteQueryBuilder.
Part 4, query-algebrizer: use Rc.
Part 5, db: use Rc.
Part 6, query-parser: use Rc.
Part 7, query-projector: use Rc.
Part 8, query-translator: use Rc.
Part 9, top level: use Rc.
Part 10: intern Ident and IdentOrKeyword.
2017-04-02 21:38:36 -07:00

50 lines
1.7 KiB
Rust

// Copyright 2016 Mozilla
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
// this file except in compliance with the License. You may obtain a copy of the
// License at http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software distributed
// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
// CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
extern crate mentat_query;
use self::mentat_query::{
PlainSymbol,
};
error_chain! {
types {
Error, ErrorKind, ResultExt, Result;
}
errors {
UnknownFunction(name: PlainSymbol) {
description("no such function")
display("no function named {}", name)
}
InvalidNumberOfArguments(name: PlainSymbol, number: usize, expected: usize) {
description("invalid number of arguments")
display("invalid number of arguments to {}: expected {}, got {}.", name, expected, number)
}
UnboundVariable(name: PlainSymbol) {
description("unbound variable in function call")
display("unbound variable: {}", name)
}
NonNumericArgument(function: PlainSymbol, position: usize) {
description("invalid argument")
display("invalid argument to {}: expected numeric in position {}.", function, position)
}
NonMatchingVariablesInOrClause {
// TODO: flesh out.
description("non-matching variables in 'or' clause")
display("non-matching variables in 'or' clause")
}
}
}