1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// SPDX-FileCopyrightText: 2025 The vita49-rs Authors
//
// SPDX-License-Identifier: MIT OR Apache-2.0
/*!
Error types/enumerations for the `vita49` crate.
*/
use thiserror::Error;
/// Generic `vita49` crate error enumeration.
#[derive(Error, Debug)]
pub enum VitaError {
/// Indicates a payload that requires an even number of 32-bit words
/// was given something else.
#[error("payload must be an even number of 32-bit words")]
PayloadUneven32BitWords,
/// Error given when a function that can only operate on signal
/// data packets is executed on something else.
#[error("function can only run on signal data packets")]
SignalDataOnly,
/// Error given when a function that can only operate on context
/// packets is executed on something else.
#[error("function can only run on context packets")]
ContextOnly,
/// Error given when a function that can only operate on command
/// packets is executed on something else.
#[error("function can only run on command packets")]
CommandOnly,
/// Error given when a function that can only operate on control
/// sub-packets is executed on something else.
#[error("function can only run on control command packets")]
ControlOnly,
/// Error given when a function that can only operate on cancellation
/// sub-packets is executed on something else.
#[error("function can only run on cancellation command packets")]
CancellationOnly,
/// Error given when a function that can only operate on validation ACK
/// sub-packets is executed on something else.
#[error("function can only run on validation ACK command packets")]
ValidationAckOnly,
/// Error given when a function that can only operate on execution ACK
/// sub-packets is executed on something else.
#[error("function can only run on execution ACK command packets")]
ExecAckOnly,
/// Error given when a function that can only operate on query ACK
/// sub-packets is executed on something else.
#[error("function can only run on query ACK command packets")]
QueryAckOnly,
/// Error given when attempting to set a timestamp field with a
/// Tsi or Tsf mode that doesn't make sense.
#[error("attempted to set timestamp field with Tsi/Tsf mode that doesn't make sense")]
TimestampModeMismatch,
/// Error given when attempting to use a controller/controllee ID
/// while the UUID is set. ID and UUID are mutually exclusive.
#[error("attempted to set controllee/controller ID field when UUID field is set")]
TriedIdWhenUuidSet,
/// Error given when attempting to use a controller/controllee UUID
/// while the ID is set. ID and UUID are mutually exclusive.
#[error("attempted to set controllee/controller UUID field when ID field is set")]
TriedUuidWhenIdSet,
/// Error given when attempting to use an out-of-range value.
#[error("out of range")]
OutOfRange,
/// Error given when trying to set a reserved value.
#[error("attempted to set reserved field")]
ReservedField,
}