mirror of
https://github.com/netbirdio/IronRDP.git
synced 2026-05-22 18:43:12 -07:00
refactor(cliprdr): hand-implement Error trait
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
committed by
Benoît Cortier
parent
4a40883f2b
commit
a47a12ce94
Generated
-1
@@ -2464,7 +2464,6 @@ dependencies = [
|
||||
"ironrdp-core",
|
||||
"ironrdp-pdu",
|
||||
"ironrdp-svc",
|
||||
"thiserror 1.0.69",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user