Skip to main content

agent_storage/identity/
identity_store_error.rs

1//! Failures returned by identity persistence.
2
3use super::UserId;
4use std::io;
5use thiserror::Error;
6
7#[derive(Debug, Error)]
8pub enum IdentityStoreError {
9    #[error("identity storage I/O failed: {0}")]
10    Io(#[from] io::Error),
11    #[error("identity storage serialization failed: {0}")]
12    Serialization(#[from] serde_json::Error),
13    #[error("user {0} was not found")]
14    UserNotFound(UserId),
15    #[error("identity ({provider}, {subject}) is already linked to another user")]
16    IdentityAlreadyLinked { provider: String, subject: String },
17    #[error("identity provider and subject must not be empty")]
18    EmptyIdentity,
19    #[error("display name must contain between 1 and 80 characters")]
20    InvalidDisplayName,
21    #[error("timezone must be a valid IANA-style timezone identifier")]
22    InvalidTimezone,
23}