refactor(cliprdr): hand-implement Error trait

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau
2025-07-24 06:34:50 -04:00
committed by Benoît Cortier
parent 4a40883f2b
commit a47a12ce94
3 changed files with 12 additions and 7 deletions
Generated
-1
View File
@@ -2464,7 +2464,6 @@ dependencies = [
"ironrdp-core",
"ironrdp-pdu",
"ironrdp-svc",
"thiserror 1.0.69",
"tracing",
]
-1
View File
@@ -19,7 +19,6 @@ test = false
ironrdp-core = { path = "../ironrdp-core", version = "0.1" } # public
ironrdp-pdu = { path = "../ironrdp-pdu", version = "0.5" } # public
ironrdp-svc = { path = "../ironrdp-svc", version = "0.4" } # public
thiserror = "1.0" # FIXME: handwrite the Error trait implementations.
tracing = { version = "0.1", features = ["log"] }
bitflags = "2.9"
+12 -5
View File
@@ -22,7 +22,6 @@ use pdu::{
ClipboardPdu, ClipboardProtocolVersion, FileContentsResponse, FormatDataRequest, FormatListResponse,
OwnedFormatDataResponse,
};
use thiserror::Error;
use tracing::{error, info};
#[rustfmt::skip] // do not reorder
@@ -31,15 +30,23 @@ use crate::pdu::FormatList;
/// PDUs for sending to the server on the CLIPRDR channel.
pub type CliprdrSvcMessages<R> = SvcProcessorMessages<Cliprdr<R>>;
#[derive(Debug, Error)]
#[derive(Debug)]
enum ClipboardError {
#[error("received clipboard PDU is not implemented")]
UnimplementedPdu { pdu: &'static str },
#[error("sent format list was rejected")]
FormatListRejected,
}
impl core::fmt::Display for ClipboardError {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self {
ClipboardError::UnimplementedPdu { pdu } => {
write!(f, "received clipboard PDU `{pdu}` is not implemented")
}
ClipboardError::FormatListRejected => write!(f, "sent format list was rejected"),
}
}
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
enum CliprdrState {
Initialization,