lab_resource_manager/domain/aggregates/identity_link/
errors.rs1use super::value_objects::ExternalSystem;
2use std::fmt;
3
4#[derive(Debug, Clone, PartialEq)]
6pub enum IdentityLinkError {
7 IdentityAlreadyExists {
9 system: ExternalSystem,
11 },
12 IdentityNotFound {
14 system: ExternalSystem,
16 },
17}
18
19impl fmt::Display for IdentityLinkError {
20 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
21 match self {
22 Self::IdentityAlreadyExists { system } => {
23 write!(
24 f,
25 "外部システム {} の識別情報は既に登録されています",
26 system.as_str()
27 )
28 }
29 Self::IdentityNotFound { system } => {
30 write!(
31 f,
32 "外部システム {} の識別情報が見つかりません",
33 system.as_str()
34 )
35 }
36 }
37 }
38}
39
40impl std::error::Error for IdentityLinkError {}
41
42impl crate::domain::errors::DomainError for IdentityLinkError {}