Skip to content

Commit bd53c2c

Browse files
authored
Merge pull request #12 from njam/serde-original-error
Include original Serde error in error message
2 parents 463756a + c51e74a commit bd53c2c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ impl<S: serde::Serializer> SerdeSerializer<S> {
5656
/// Start serializing map of values
5757
fn start(ser: S, len: Option<usize>) -> result::Result<Self, slog::Error> {
5858
let ser_map = try!(ser.serialize_map(len)
59-
.map_err(|_| {
59+
.map_err(|e| {
6060
io::Error::new(io::ErrorKind::Other,
61-
"serde serialization error")
61+
format!("serde serialization error: {}", e))
6262
}));
6363
Ok(SerdeSerializer { ser_map: ser_map })
6464
}
@@ -73,7 +73,7 @@ macro_rules! impl_m(
7373
($s:expr, $key:expr, $val:expr) => ({
7474
let k_s: &str = $key.as_ref();
7575
try!($s.ser_map.serialize_entry(k_s, $val)
76-
.map_err(|_| io::Error::new(io::ErrorKind::Other, "serde serialization error")));
76+
.map_err(|e| io::Error::new(io::ErrorKind::Other, format!("serde serialization error: {}", e))));
7777
Ok(())
7878
});
7979
);

0 commit comments

Comments
 (0)