Skip to main content

sql_traits/
errors.rs

1// Copyright 2016-2018 Mozilla
2//
3// Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4// this file except in compliance with the License. You may obtain a copy of the
5// License at http://www.apache.org/licenses/LICENSE-2.0
6// Unless required by applicable law or agreed to in writing, software distributed
7// under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
8// CONDITIONS OF ANY KIND, either express or implied. See the License for the
9// specific language governing permissions and limitations under the License.
10
11use thiserror::Error;
12
13/// New variants may be added in minor releases: match with a `_` arm.
14#[derive(Debug, Error)]
15#[non_exhaustive]
16pub enum SQLError {
17    #[error("invalid parameter name: {0}")]
18    InvalidParameterName(String),
19
20    #[error("parameter name could be generated: '{0}'")]
21    BindParamCouldBeGenerated(String),
22
23    #[error("malformed MATCH expression: [{0}]")]
24    MalformedMatch(String),
25}
26
27pub type BuildQueryResult = Result<(), SQLError>;