pub enum MailError {
UnknownParticipant {
participant: ParticipantId,
},
UnknownRoom {
room: RoomId,
},
UnknownSession {
session: SessionId,
},
SessionAccountMismatch {
session: SessionId,
expected: ParticipantId,
presented: ParticipantId,
},
UnknownMessage {
message_id: MessageId,
},
NotAddressedToYou {
message_id: MessageId,
},
PermissionDenied {
need: String,
},
Malformed {
field: String,
reason: String,
},
TooLarge {
field: String,
limit: usize,
actual: usize,
},
StoreUnavailable {
operation: String,
},
}Expand description
A named refusal. Every variant names its inputs so a caller learns what
was refused and why from the refusal alone – never a bare Internal
(the crate contract’s own discipline; see mail4agent/CLAUDE.md).
UnknownParticipant/UnknownRoom carry the offending id even though the
task’s own sketch of this enum omitted their fields: an “unknown X”
refusal that does not say which X is exactly the unnamed-refusal failure
mode the crate contract calls out by name.
Variants§
UnknownParticipant
No participant is registered under this id.
Fields
participant: ParticipantIdUnknownRoom
No room is registered under this id.
UnknownSession
No session is registered under this id – it has never been named in
an Address::Session that reached Address::Session’s
registering call, MailboxEngine::ensure_session.
SessionAccountMismatch
session is registered, but under a different account than the one
presented alongside it in an Address::Session. Refused rather
than silently resolved either way, because either party being wrong
about which account owns a session is exactly the confusion the
account/session split exists to prevent.
UnknownMessage
No message is stored under this id.
NotAddressedToYou
The message exists, but was not sent to the caller (not their direct address, and not a room they belong to).
PermissionDenied
The caller’s credential does not carry the capability the operation
needs. need names the missing capability, e.g. "mail:send".
Malformed
A field failed structural validation. reason says how.
TooLarge
A field exceeded its bound. Carries both the bound and what was sent so the caller can act without a second round trip.
The storage layer could not complete operation (a filesystem
error, a lock, a corrupt row – never a domain refusal). Names only
the operation, never the underlying cause: that cause is logged
server-side for the operator, so a caller learns what failed
without a path or a driver’s error text leaving the process.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for MailError
impl<'de> Deserialize<'de> for MailError
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for MailError
Source§impl Error for MailError
impl Error for MailError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()