|
1 |
| -use crate::error; |
2 |
| -use crate::error::*; |
3 |
| -use crate::role_utils::{CommonConfiguration, Role}; |
4 |
| -use product_config::types::PropertyNameKind; |
5 |
| -use product_config::{ProductConfigManager, PropertyValidationResult}; |
| 1 | +use std::collections::{BTreeMap, HashMap}; |
| 2 | + |
| 3 | +use product_config::{types::PropertyNameKind, ProductConfigManager, PropertyValidationResult}; |
6 | 4 | use schemars::JsonSchema;
|
7 | 5 | use serde::Serialize;
|
8 |
| -use std::collections::{BTreeMap, HashMap}; |
9 |
| -use thiserror::Error; |
| 6 | +use snafu::Snafu; |
10 | 7 | use tracing::{debug, error, warn};
|
11 | 8 |
|
12 |
| -#[derive(Error, Debug)] |
| 9 | +use crate::{ |
| 10 | + error::{Error, OperatorResult}, |
| 11 | + role_utils::{CommonConfiguration, Role}, |
| 12 | +}; |
| 13 | + |
| 14 | +#[derive(Debug, Snafu)] |
13 | 15 | pub enum ConfigError {
|
14 |
| - #[error("Invalid configuration found: {reason}")] |
| 16 | + #[snafu(display("Invalid configuration found: {reason}"))] |
15 | 17 | InvalidConfiguration { reason: String },
|
16 | 18 |
|
17 |
| - #[error("Collected product config validation errors: {collected_errors:?}")] |
| 19 | + #[snafu(display("Collected product config validation errors: {collected_errors:?}"))] |
18 | 20 | ProductConfigErrors {
|
19 | 21 | collected_errors: Vec<product_config::error::Error>,
|
20 | 22 | },
|
@@ -121,13 +123,13 @@ pub fn config_for_role_and_group<'a>(
|
121 | 123 | ) -> OperatorResult<&'a HashMap<PropertyNameKind, BTreeMap<String, String>>> {
|
122 | 124 | let result = match role_config.get(role) {
|
123 | 125 | None => {
|
124 |
| - return Err(error::Error::MissingRole { |
| 126 | + return Err(Error::MissingRole { |
125 | 127 | role: role.to_string(),
|
126 | 128 | })
|
127 | 129 | }
|
128 | 130 | Some(group_config) => match group_config.get(group) {
|
129 | 131 | None => {
|
130 |
| - return Err(error::Error::MissingRoleGroup { |
| 132 | + return Err(Error::MissingRoleGroup { |
131 | 133 | role: role.to_string(),
|
132 | 134 | role_group: group.to_string(),
|
133 | 135 | })
|
|
0 commit comments