Skip to content

Commit a9f4457

Browse files
committed
some more work
1 parent 82990a1 commit a9f4457

File tree

4 files changed

+7
-61
lines changed

4 files changed

+7
-61
lines changed

src/error.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@ use thiserror::Error;
1111
target_os = "illumos",
1212
)
1313
))]
14-
pub use crate::platform::UnixError;
15-
16-
#[cfg(target_os = "macos")]
17-
pub use crate::platform::MachError;
18-
1914
#[derive(Debug, Error)]
2015
pub enum IpcError {
2116
#[error("Error in decoding or encoding")]
@@ -24,21 +19,6 @@ pub enum IpcError {
2419
Io(#[from] io::Error),
2520
#[error("Ipc Disconnected")]
2621
Disconnected,
27-
#[error("Platform Error")]
28-
#[cfg(all(
29-
not(feature = "force-inprocess"),
30-
any(
31-
target_os = "linux",
32-
target_os = "openbsd",
33-
target_os = "freebsd",
34-
target_os = "illumos",
35-
)
36-
))]
37-
PlatformError(UnixError),
38-
#[cfg(all(not(feature = "force-inprocess"), target_os = "windows"))]
39-
PlatformError(#[from] windows::core::Error),
40-
#[cfg(target_os = "macos")]
41-
PlatformError(#[from] crate::platform::macos::MachError),
4222
}
4323

4424
#[derive(Debug, Error)]

src/platform/inprocess/mod.rs

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -387,11 +387,15 @@ impl OsIpcSharedMemory {
387387
}
388388
}
389389

390-
#[derive(Debug, PartialEq)]
390+
#[derive(Debug, PartialEq, Error)]
391391
pub enum ChannelError {
392+
#[error("Channel Closed")]
392393
ChannelClosedError,
394+
#[error("Broken Pipe")]
393395
BrokenPipeError,
396+
#[error("Channel Empty")]
394397
ChannelEmpty,
398+
#[error("Unknown Error")]
395399
UnknownError,
396400
}
397401

@@ -402,30 +406,11 @@ impl ChannelError {
402406
}
403407
}
404408

405-
impl fmt::Display for ChannelError {
406-
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
407-
match *self {
408-
ChannelError::ChannelClosedError => write!(fmt, "channel closed"),
409-
ChannelError::BrokenPipeError => write!(fmt, "broken pipe"),
410-
ChannelError::ChannelEmpty => write!(fmt, "channel empty"),
411-
ChannelError::UnknownError => write!(fmt, "unknown error"),
412-
}
413-
}
414-
}
415-
416-
impl StdError for ChannelError {}
417-
418-
impl From<ChannelError> for bincode::Error {
419-
fn from(crossbeam_error: ChannelError) -> Self {
420-
io::Error::from(crossbeam_error).into()
421-
}
422-
}
423-
424409
impl From<ChannelError> for ipc::IpcError {
425410
fn from(error: ChannelError) -> Self {
426411
match error {
427412
ChannelError::ChannelClosedError => ipc::IpcError::Disconnected,
428-
e => ipc::IpcError::Bincode(io::Error::from(e).into()),
413+
e => ipc::IpcError::Io(io::Error::from(e).into()),
429414
}
430415
}
431416
}
@@ -437,7 +422,7 @@ impl From<ChannelError> for ipc::TryRecvError {
437422
ipc::TryRecvError::IpcError(ipc::IpcError::Disconnected)
438423
},
439424
ChannelError::ChannelEmpty => ipc::TryRecvError::Empty,
440-
e => ipc::TryRecvError::IpcError(ipc::IpcError::Bincode(io::Error::from(e).into())),
425+
e => ipc::TryRecvError::IpcError(ipc::IpcError::Io(io::Error::from(e).into())),
441426
}
442427
}
443428
}

src/platform/mod.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,5 @@ pub use self::os::{channel, OsOpaqueIpcChannel};
6767
pub use self::os::{OsIpcChannel, OsIpcOneShotServer, OsIpcReceiver, OsIpcReceiverSet};
6868
pub use self::os::{OsIpcSelectionResult, OsIpcSender, OsIpcSharedMemory};
6969

70-
#[cfg(all(not(feature = "force-inprocess"), target_os = "macos"))]
71-
pub use macos::MachError;
72-
#[cfg(all(
73-
not(feature = "force-inprocess"),
74-
any(
75-
target_os = "linux",
76-
target_os = "openbsd",
77-
target_os = "freebsd",
78-
target_os = "illumos",
79-
)
80-
))]
81-
pub use unix::UnixError;
82-
8370
#[cfg(test)]
8471
mod test;

src/platform/windows/mod.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1967,12 +1967,6 @@ impl WinIpcError {
19671967
}
19681968
}
19691969

1970-
impl From<WinError> for WinIpcError {
1971-
fn from(e: WinError) -> Self {
1972-
Self::WinError(e)
1973-
}
1974-
}
1975-
19761970
impl From<WinIpcError> for ipc::IpcError {
19771971
fn from(error: WinIpcError) -> Self {
19781972
match error {

0 commit comments

Comments
 (0)