Skip to main content

derec_library/derec_message/
error.rs

1// SPDX-License-Identifier: Apache-2.0
2// Copyright (c) 2026 DeRec Alliance. All rights reserved.
3
4use std::time::SystemTime;
5use thiserror::Error;
6
7#[derive(Debug, Error)]
8#[non_exhaustive]
9pub enum DeRecMessageBuilderError {
10    #[error("missing channel_id")]
11    MissingChannelId,
12
13    #[error("missing timestamp")]
14    MissingTimestamp,
15
16    #[error("missing message")]
17    MissingMessage,
18
19    #[error("invalid timestamp: {0:?}")]
20    InvalidTimestamp(SystemTime),
21
22    #[error(transparent)]
23    Encryption(#[from] derec_cryptography::channel::DerecChannelError),
24
25    #[error(transparent)]
26    PairingEncryption(#[from] derec_cryptography::pairing::envelope::DerecEncryptionError),
27}