Update ipc-channel to pick up the improved error reporting.

Intended to help diagnose intermittent failures.
This commit is contained in:
Patrick Walton 2015-11-23 16:08:52 -08:00
parent 6449cd09eb
commit 2843000810
23 changed files with 84 additions and 78 deletions

View file

@ -8,6 +8,7 @@ use opts;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use std::any::{Any, TypeId};
use std::collections::HashMap;
use std::io::{Error, ErrorKind};
use std::marker::Reflect;
use std::mem;
use std::sync::Mutex;
@ -27,10 +28,12 @@ pub enum OptionalIpcSender<T> where T: Deserialize + Serialize + Send + Any {
}
impl<T> OptionalIpcSender<T> where T: Deserialize + Serialize + Send + Any {
pub fn send(&self, value: T) -> Result<(), ()> {
pub fn send(&self, value: T) -> Result<(), Error> {
match *self {
OptionalIpcSender::OutOfProcess(ref ipc_sender) => ipc_sender.send(value),
OptionalIpcSender::InProcess(ref sender) => sender.send(value).map_err(|_| ()),
OptionalIpcSender::InProcess(ref sender) => {
sender.send(value).map_err(|_| Error::new(ErrorKind::Other, "MPSC send failed"))
}
}
}