openstack_keystone_core/federation/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//! # Federation provider error
15use thiserror::Error;
16
17use crate::error::BuilderError;
18
19/// Federation provider error.
20#[derive(Error, Debug)]
21pub enum FederationProviderError {
22 #[error("authentication state is not found")]
23 AuthStateNotFound(String),
24
25 /// Conflict.
26 #[error("conflict: {0}")]
27 Conflict(String),
28
29 /// Driver error.
30 #[error("backend driver error: {0}")]
31 Driver(String),
32
33 /// IDP not found.
34 #[error("identity provider {0} not found")]
35 IdentityProviderNotFound(String),
36
37 /// Mapping not found.
38 #[error("mapping {0} not found")]
39 MappingNotFound(String),
40
41 /// Use of token_project_id requires domain_id to be set.
42 #[error("`mapping.domain_id` must be set")]
43 MappingTokenProjectDomainUnset,
44
45 /// Use of token_user_id requires domain_id to be set.
46 #[error("`mapping.domain_id` must be set")]
47 MappingTokenUserDomainUnset,
48
49 /// Identity provider error.
50 #[error("data serialization error")]
51 Serde {
52 #[from]
53 source: serde_json::Error,
54 },
55
56 /// Structures builder error.
57 #[error(transparent)]
58 StructBuilder {
59 /// The source of the error.
60 #[from]
61 source: BuilderError,
62 },
63
64 /// Unsupported driver.
65 #[error("unsupported driver `{0}` for the federation provider")]
66 UnsupportedDriver(String),
67}