tss_esapi/error/
wrapper.rs1#[derive(Debug, Copy, Clone, PartialEq, Eq)]
5#[non_exhaustive]
6pub enum WrapperErrorKind {
7 WrongParamSize,
10 ParamsMissing,
12 InconsistentParams,
14 UnsupportedParam,
16 InvalidParam,
18 WrongValueFromTpm,
20 MissingAuthSession,
23 InvalidHandleState,
26 InternalError,
28}
29
30impl std::fmt::Display for WrapperErrorKind {
31 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
32 match self {
33 WrapperErrorKind::WrongParamSize => {
34 write!(f, "Parameter provided is of the wrong size.")
35 }
36 WrapperErrorKind::ParamsMissing => {
37 write!(f, "Some of the required parameters were not provided.")
38 }
39 WrapperErrorKind::InconsistentParams => write!(
40 f,
41 "The provided parameters have inconsistent values or variants."
42 ),
43 WrapperErrorKind::UnsupportedParam => write!(
44 f,
45 "The provided parameter is not yet supported by the library."
46 ),
47 WrapperErrorKind::InvalidParam => {
48 write!(f, "The provided parameter is invalid for that type.")
49 }
50 WrapperErrorKind::WrongValueFromTpm => write!(f, "The TPM returned an invalid value."),
51 WrapperErrorKind::MissingAuthSession => write!(f, "Missing authorization session."),
52 WrapperErrorKind::InvalidHandleState => write!(f, "Invalid handle state."),
53 WrapperErrorKind::InternalError => {
54 write!(f, "An unexpected error occurred within the crate.")
55 }
56 }
57 }
58}
59
60impl std::error::Error for WrapperErrorKind {}