openstack_keystone_core/role/error.rs
1// Licensed under the Apache License, Version 2.0 (the "License");
2// you may not use this file except in compliance with the License.
3// You may obtain a copy of the License at
4//
5// http://www.apache.org/licenses/LICENSE-2.0
6//
7// Unless required by applicable law or agreed to in writing, software
8// distributed under the License is distributed on an "AS IS" BASIS,
9// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10// See the License for the specific language governing permissions and
11// limitations under the License.
12//
13// SPDX-License-Identifier: Apache-2.0
14//! # Role provider error types
15use thiserror::Error;
16
17/// Role provider error.
18#[derive(Error, Debug)]
19pub enum RoleProviderError {
20 /// Conflict.
21 #[error("conflict: {0}")]
22 Conflict(String),
23
24 /// Driver error.
25 #[error("backend driver error: {0}")]
26 Driver(String),
27
28 /// Role not found.
29 #[error("role {0} not found")]
30 RoleNotFound(String),
31
32 /// (de)serialize error.
33 #[error(transparent)]
34 Serde {
35 #[from]
36 source: serde_json::Error,
37 },
38
39 /// Structures builder error.
40 #[error(transparent)]
41 StructBuilder {
42 /// The source of the error.
43 #[from]
44 source: crate::error::BuilderError,
45 },
46
47 /// Unsupported driver.
48 #[error("unsupported driver `{0}` for the role provider")]
49 UnsupportedDriver(String),
50
51 /// Validation error.
52 #[error("request validation error: {}", source)]
53 Validation {
54 /// The source of the error.
55 #[from]
56 source: validator::ValidationErrors,
57 },
58}