#[non_exhaustive]pub enum SetErrorType {
Show 24 variants
Forbidden,
OverQuota,
TooLarge,
RateLimit,
NotFound,
InvalidPatch,
WillDestroy,
InvalidProperties,
Singleton,
AlreadyExists,
MailboxHasChild,
MailboxHasEmail,
TooManyKeywords,
TooManyMailboxes,
BlobNotFound,
ForbiddenFrom,
InvalidEmail,
TooManyRecipients,
NoRecipients,
InvalidRecipients,
ForbiddenMailFrom,
ForbiddenToSend,
CannotUnsend,
Custom(String),
}Expand description
The machine-readable type for a SetError (RFC 8620 §5.3 and RFC 8621).
§Variant policy
The variant set below carries:
- The 10 RFC 8620 §5.3 base error types
(
Forbidden,OverQuota,TooLarge,RateLimit,NotFound,InvalidPatch,WillDestroy,InvalidProperties,Singleton,AlreadyExists). - 13 RFC 8621 mail-specific error types
(
MailboxHasChild,MailboxHasEmail,TooManyKeywords,TooManyMailboxes,BlobNotFound,ForbiddenFrom,InvalidEmail,TooManyRecipients,NoRecipients,InvalidRecipients,ForbiddenMailFrom,ForbiddenToSend,CannotUnsend). These predate the canonical-template extraction and ship in the foundation for back-compat with existingjmap-mail-servercallers (bd:JMAP-wlip.19). Self::Customfor everything else.
New extension errors MUST use Self::custom. Other JMAP
extensions (chat, calendars, tasks, contacts, filenode, sharing,
metadata) ship their error strings via custom("rateLimited"),
custom("addressBookHasContents"), custom("invalidSieve"), etc.
The known wire-name table inside the private from_wire_str helper
is the authoritative list of typed variants — any wire-name outside
that list round-trips as Custom(s).
The mail-variants asymmetry is documented but not yet reshaped.
Moving the 13 mail variants to jmap-mail-types is a breaking
change that requires a workspace-wide major version bump and
propagation across every *-server extension crate; it is tracked
separately rather than performed silently. Until that bump, do not
add further extension-specific variants here — even mail-style
extensions like Calendars / Tasks / Contacts use Self::custom.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Forbidden
The action would violate an ACL or other access control policy.
OverQuota
Creating or modifying the object would exceed a server quota.
TooLarge
The object is too large to be stored by the server.
RateLimit
The server is rate-limiting this client.
NotFound
The object to be updated or destroyed does not exist.
InvalidPatch
The patch object is not a valid JSON Merge Patch or cannot be applied.
WillDestroy
The client requested destruction of an object that will be destroyed implicitly when another object is destroyed.
InvalidProperties
One or more properties have invalid values.
Singleton
The object type is a singleton and cannot be created or destroyed.
AlreadyExists
An object with the same unique key already exists.
MailboxHasChild
RFC 8621 §2.5 — Mailbox has child mailboxes and cannot be destroyed.
MailboxHasEmail
RFC 8621 §2.5 — Mailbox contains emails and onDestroyRemoveEmails is false.
TooManyKeywords
RFC 8621 §5.5 — Too many keywords on the Email.
TooManyMailboxes
RFC 8621 §5.5 — Email is in too many mailboxes.
BlobNotFound
RFC 8621 §5.5 — A referenced blob was not found.
ForbiddenFrom
RFC 8621 §6.3 — The from address is not permitted for this Identity.
InvalidEmail
RFC 8621 §7.5 — The Email is invalid for submission.
TooManyRecipients
RFC 8621 §7.5 — Too many recipients.
NoRecipients
RFC 8621 §7.5 — No recipients specified.
InvalidRecipients
RFC 8621 §7.5 — One or more recipient addresses are invalid.
ForbiddenMailFrom
RFC 8621 §7.5 — The MAIL FROM address is not permitted.
ForbiddenToSend
RFC 8621 §7.5 — The user does not have send permission.
CannotUnsend
RFC 8621 §7.5 — The submission cannot be undone.
Custom(String)
An extension-defined error type not covered by the variants above.
Serializes as the inner string directly (e.g. "mdnAlreadySent").
Implementations§
Source§impl SetErrorType
impl SetErrorType
Sourcepub fn custom(s: impl Into<String>) -> Self
pub fn custom(s: impl Into<String>) -> Self
Construct a SetErrorType from any string, canonicalising
known wire-names back to their typed variant.
custom("forbidden") returns SetErrorType::Forbidden, NOT
Custom("forbidden"). Only strings that do not match any known
JMAP wire-name produce SetErrorType::Custom. This makes
round-trip symmetric — custom(s) equals the result of
deserialising "s" for every s, eliminating the silent
contract drift filed as bd:JMAP-wlip.22.
Use this in extension crates to emit domain-specific error
types without adding variants to this enum; if your extension’s
chosen name later becomes a typed variant in this crate, the
call site keeps working — custom("mdnAlreadySent") returns
Custom("mdnAlreadySent") today and would return the typed
variant when that variant is added.
Trait Implementations§
Source§impl Clone for SetErrorType
impl Clone for SetErrorType
Source§fn clone(&self) -> SetErrorType
fn clone(&self) -> SetErrorType
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SetErrorType
impl Debug for SetErrorType
Source§impl<'de> Deserialize<'de> for SetErrorType
impl<'de> Deserialize<'de> for SetErrorType
Source§fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(d: D) -> Result<Self, D::Error>
Source§impl Display for SetErrorType
impl Display for SetErrorType
Source§impl PartialEq for SetErrorType
impl PartialEq for SetErrorType
Source§fn eq(&self, other: &SetErrorType) -> bool
fn eq(&self, other: &SetErrorType) -> bool
self and other values to be equal, and is used by ==.