1#[derive(Debug, thiserror::Error, miette::Diagnostic)]
2pub enum MlsSpecError {
3 #[error("This wire format identifier is outside the private reserved use range")]
4 #[diagnostic(code(mls_spec::invalid_private_range_wireformat))]
5 InvalidPrivateRangeWireFormat,
6 #[error("This ciphersuite identifier is outside the private reserved use range")]
7 #[diagnostic(code(mls_spec::invalid_private_range_ciphersuite))]
8 InvalidPrivateRangeCiphersuite,
9 #[error("This extension type identifier is outside the private reserved use range")]
10 #[diagnostic(code(mls_spec::invalid_private_range_extension_type))]
11 InvalidPrivateRangeExtensionType,
12 #[error("This proposal type identifier is outside the private reserved use range")]
13 #[diagnostic(code(mls_spec::invalid_private_range_proposal_type))]
14 InvalidPrivateRangeProposalType,
15 #[error("This credential type identifier is outside the private reserved use range")]
16 #[diagnostic(code(mls_spec::invalid_private_range_credential_type))]
17 InvalidPrivateRangeCredentialType,
18 #[error("This content type identifier is outside the specification")]
19 #[diagnostic(code(mls_spec::invalid_content_type))]
20 InvalidContentType,
21 #[error("Trying to build a FramedContentTBS but the GroupContext hasn't been provided")]
22 #[diagnostic(code(mls_spec::missing_ctx))]
23 FramedContentTBSMissingGroupContext,
24 #[error(
25 "A reserved value has been used. While we do have definitions for them, they're not supposed to be used in-protocol"
26 )]
27 #[diagnostic(code(mls_spec::reserved_value_usage))]
28 ReservedValueUsage,
29 #[error("You have tried to use an invalid value spec-wise")]
30 #[diagnostic(code(mls_spec::invalid_spec_value))]
31 InvalidSpecValue,
32 #[error(transparent)]
33 #[diagnostic(code(mls_spec::tls_codec_error))]
34 #[diagnostic_source]
35 TlsCodecError(#[from] tls_codec::Error),
36 #[cfg(feature = "mls-rs-compat")]
37 #[error(transparent)]
38 #[diagnostic(code(mls_spec::mls_rs_codec_error))]
39 #[diagnostic_source]
40 MlsRsCodecError(#[from] mls_rs_codec::Error),
41 #[cfg(feature = "draft-ietf-mls-extensions")]
42 #[error("The Parameter value isn't utf-8")]
43 #[diagnostic(code(mls_spec::content_adv_utf8_param_err))]
44 ContentAdvertisementUtf8ParameterError,
45 #[cfg(feature = "draft-ietf-mls-extensions-content-advertisement-parse")]
46 #[error(transparent)]
47 #[diagnostic(code(mls_spec::content_adv_invalid_mimetype))]
48 ContentAdvertisementInvalidMimeType(#[from] mediatype::MediaTypeError),
49 #[cfg(feature = "draft-ietf-mls-extensions")]
50 #[error("SafeApp component ID is outside the private reserved use range")]
51 #[diagnostic(code(mls_spec::invalid_private_range_component_id))]
52 InvalidPrivateRangeComponentId,
53 #[cfg(feature = "draft-ietf-mls-extensions")]
54 #[error("SafeApp component ID mismatches, expected {expected}, but data contains {actual}")]
55 #[diagnostic(code(mls_spec::safe_app_component_id_mismatch))]
56 SafeAppComponentIdMismatch {
57 expected: crate::drafts::mls_extensions::safe_application::ComponentId,
58 actual: crate::drafts::mls_extensions::safe_application::ComponentId,
59 },
60}
61
62pub type MlsSpecResult<T> = Result<T, MlsSpecError>;