| 53 | |
| 54 | impl DetailableError for UserError { |
| 55 | fn details(&self) -> Option<std::collections::HashMap<String, String>> { |
| 56 | let mut details = std::collections::HashMap::new(); |
| 57 | match self { |
| 58 | UserError::IdentityAlreadyHasUser { user } => { |
| 59 | details.insert("user".to_string(), user.to_string()); |
| 60 | Some(details) |
| 61 | } |
| 62 | UserError::NotFound { user } => { |
| 63 | details.insert("user".to_string(), user.to_string()); |
| 64 | Some(details) |
| 65 | } |
| 66 | UserError::Forbidden { user } => { |
| 67 | details.insert("user".to_string(), user.to_string()); |
| 68 | Some(details) |
| 69 | } |
| 70 | UserError::ValidationError { info } => { |
| 71 | details.insert("info".to_string(), info.to_string()); |
| 72 | Some(details) |
| 73 | } |
| 74 | UserError::AssociatedUserIdentityNotFound { identity } => { |
| 75 | details.insert("identity".to_string(), identity.to_string()); |
| 76 | Some(details) |
| 77 | } |
| 78 | UserError::BadUserSubscriptionStatus { |
| 79 | subscription_status, |
| 80 | } => { |
| 81 | details.insert( |
| 82 | "subscription_status".to_string(), |
| 83 | subscription_status.to_string(), |
| 84 | ); |
| 85 | Some(details) |
| 86 | } |
| 87 | UserError::StationHasTooManyLabels { max_labels } => { |
| 88 | details.insert("max_labels".to_string(), max_labels.to_string()); |
| 89 | Some(details) |
| 90 | } |
| 91 | _ => None, |
| 92 | } |
| 93 | } |
| 94 | } |