diff --git a/src/mp4box/avc1.rs b/src/mp4box/avc1.rs index 7174122..7226d5d 100644 --- a/src/mp4box/avc1.rs +++ b/src/mp4box/avc1.rs @@ -68,7 +68,7 @@ impl Mp4Box for Avc1Box { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { @@ -200,7 +200,7 @@ impl Mp4Box for AvcCBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/co64.rs b/src/mp4box/co64.rs index 978137e..c6f77d3 100644 --- a/src/mp4box/co64.rs +++ b/src/mp4box/co64.rs @@ -34,7 +34,7 @@ impl Mp4Box for Co64Box { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/ctts.rs b/src/mp4box/ctts.rs index 673e8c9..7316c9b 100644 --- a/src/mp4box/ctts.rs +++ b/src/mp4box/ctts.rs @@ -40,7 +40,7 @@ impl Mp4Box for CttsBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/data.rs b/src/mp4box/data.rs index 19b5c77..f49631e 100644 --- a/src/mp4box/data.rs +++ b/src/mp4box/data.rs @@ -37,7 +37,7 @@ impl Mp4Box for DataBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/dinf.rs b/src/mp4box/dinf.rs index 46698c9..ad78a0f 100644 --- a/src/mp4box/dinf.rs +++ b/src/mp4box/dinf.rs @@ -28,7 +28,7 @@ impl Mp4Box for DinfBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { @@ -132,7 +132,7 @@ impl Mp4Box for DrefBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { @@ -249,7 +249,7 @@ impl Mp4Box for UrlBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/edts.rs b/src/mp4box/edts.rs index 9077bb1..5ab5962 100644 --- a/src/mp4box/edts.rs +++ b/src/mp4box/edts.rs @@ -37,7 +37,7 @@ impl Mp4Box for EdtsBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/elst.rs b/src/mp4box/elst.rs index 297fb63..79267e5 100644 --- a/src/mp4box/elst.rs +++ b/src/mp4box/elst.rs @@ -48,7 +48,7 @@ impl Mp4Box for ElstBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/emsg.rs b/src/mp4box/emsg.rs index f68ba3a..c03bcae 100644 --- a/src/mp4box/emsg.rs +++ b/src/mp4box/emsg.rs @@ -49,7 +49,7 @@ impl Mp4Box for EmsgBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/ftyp.rs b/src/mp4box/ftyp.rs index 789cd4e..36c8e36 100644 --- a/src/mp4box/ftyp.rs +++ b/src/mp4box/ftyp.rs @@ -31,7 +31,7 @@ impl Mp4Box for FtypBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/hdlr.rs b/src/mp4box/hdlr.rs index 1ff559e..99455ce 100644 --- a/src/mp4box/hdlr.rs +++ b/src/mp4box/hdlr.rs @@ -32,7 +32,7 @@ impl Mp4Box for HdlrBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/hev1.rs b/src/mp4box/hev1.rs index 3a8cfea..c0731c6 100644 --- a/src/mp4box/hev1.rs +++ b/src/mp4box/hev1.rs @@ -68,7 +68,7 @@ impl Mp4Box for Hev1Box { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { @@ -181,7 +181,7 @@ impl Mp4Box for HvcCBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/ilst.rs b/src/mp4box/ilst.rs index d0292a3..5de336a 100644 --- a/src/mp4box/ilst.rs +++ b/src/mp4box/ilst.rs @@ -37,7 +37,7 @@ impl Mp4Box for IlstBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/mdhd.rs b/src/mp4box/mdhd.rs index 31c65a8..ee4e753 100644 --- a/src/mp4box/mdhd.rs +++ b/src/mp4box/mdhd.rs @@ -58,7 +58,7 @@ impl Mp4Box for MdhdBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/mdia.rs b/src/mp4box/mdia.rs index 423bf72..3d1e159 100644 --- a/src/mp4box/mdia.rs +++ b/src/mp4box/mdia.rs @@ -31,7 +31,7 @@ impl Mp4Box for MdiaBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/mehd.rs b/src/mp4box/mehd.rs index 63c0246..0bab2a5 100644 --- a/src/mp4box/mehd.rs +++ b/src/mp4box/mehd.rs @@ -38,7 +38,7 @@ impl Mp4Box for MehdBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/meta.rs b/src/mp4box/meta.rs index df57c77..a3fe74d 100644 --- a/src/mp4box/meta.rs +++ b/src/mp4box/meta.rs @@ -57,7 +57,7 @@ impl Mp4Box for MetaBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/mfhd.rs b/src/mp4box/mfhd.rs index 7bc2f72..067aa22 100644 --- a/src/mp4box/mfhd.rs +++ b/src/mp4box/mfhd.rs @@ -41,7 +41,7 @@ impl Mp4Box for MfhdBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/minf.rs b/src/mp4box/minf.rs index 5ea853b..2ec8878 100644 --- a/src/mp4box/minf.rs +++ b/src/mp4box/minf.rs @@ -45,7 +45,7 @@ impl Mp4Box for MinfBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/moof.rs b/src/mp4box/moof.rs index 20c3565..89bcf51 100644 --- a/src/mp4box/moof.rs +++ b/src/mp4box/moof.rs @@ -36,7 +36,7 @@ impl Mp4Box for MoofBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/moov.rs b/src/mp4box/moov.rs index ac19381..194c9ae 100644 --- a/src/mp4box/moov.rs +++ b/src/mp4box/moov.rs @@ -52,7 +52,7 @@ impl Mp4Box for MoovBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/mp4a.rs b/src/mp4box/mp4a.rs index e4d6a45..e6c2a63 100644 --- a/src/mp4box/mp4a.rs +++ b/src/mp4box/mp4a.rs @@ -61,7 +61,7 @@ impl Mp4Box for Mp4aBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { @@ -170,7 +170,7 @@ impl Mp4Box for EsdsBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/mvex.rs b/src/mp4box/mvex.rs index 8be683b..31a9eab 100644 --- a/src/mp4box/mvex.rs +++ b/src/mp4box/mvex.rs @@ -30,7 +30,7 @@ impl Mp4Box for MvexBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/mvhd.rs b/src/mp4box/mvhd.rs index 462a29b..d0593b1 100644 --- a/src/mp4box/mvhd.rs +++ b/src/mp4box/mvhd.rs @@ -67,7 +67,7 @@ impl Mp4Box for MvhdBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/smhd.rs b/src/mp4box/smhd.rs index cab7e4b..f0a34c2 100644 --- a/src/mp4box/smhd.rs +++ b/src/mp4box/smhd.rs @@ -43,7 +43,7 @@ impl Mp4Box for SmhdBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/stbl.rs b/src/mp4box/stbl.rs index ef8433b..46199c1 100644 --- a/src/mp4box/stbl.rs +++ b/src/mp4box/stbl.rs @@ -64,7 +64,7 @@ impl Mp4Box for StblBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/stco.rs b/src/mp4box/stco.rs index a00da8f..daa37e0 100644 --- a/src/mp4box/stco.rs +++ b/src/mp4box/stco.rs @@ -34,7 +34,7 @@ impl Mp4Box for StcoBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/stsc.rs b/src/mp4box/stsc.rs index e5b444e..25d75bc 100644 --- a/src/mp4box/stsc.rs +++ b/src/mp4box/stsc.rs @@ -42,7 +42,7 @@ impl Mp4Box for StscBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/stsd.rs b/src/mp4box/stsd.rs index af947c6..635ac89 100644 --- a/src/mp4box/stsd.rs +++ b/src/mp4box/stsd.rs @@ -59,7 +59,7 @@ impl Mp4Box for StsdBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/stss.rs b/src/mp4box/stss.rs index dd9e552..11b8d33 100644 --- a/src/mp4box/stss.rs +++ b/src/mp4box/stss.rs @@ -34,7 +34,7 @@ impl Mp4Box for StssBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/stsz.rs b/src/mp4box/stsz.rs index b07e765..38855df 100644 --- a/src/mp4box/stsz.rs +++ b/src/mp4box/stsz.rs @@ -36,7 +36,7 @@ impl Mp4Box for StszBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/stts.rs b/src/mp4box/stts.rs index 82de6c5..66e76e5 100644 --- a/src/mp4box/stts.rs +++ b/src/mp4box/stts.rs @@ -40,7 +40,7 @@ impl Mp4Box for SttsBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/tfdt.rs b/src/mp4box/tfdt.rs index ef92889..68e55e9 100644 --- a/src/mp4box/tfdt.rs +++ b/src/mp4box/tfdt.rs @@ -37,7 +37,7 @@ impl Mp4Box for TfdtBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/tfhd.rs b/src/mp4box/tfhd.rs index e67e5cb..bc51684 100644 --- a/src/mp4box/tfhd.rs +++ b/src/mp4box/tfhd.rs @@ -58,7 +58,7 @@ impl Mp4Box for TfhdBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/tkhd.rs b/src/mp4box/tkhd.rs index d7bcfbe..58b0f6a 100644 --- a/src/mp4box/tkhd.rs +++ b/src/mp4box/tkhd.rs @@ -126,7 +126,7 @@ impl Mp4Box for TkhdBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/traf.rs b/src/mp4box/traf.rs index 51f812d..bdd5ffe 100644 --- a/src/mp4box/traf.rs +++ b/src/mp4box/traf.rs @@ -36,7 +36,7 @@ impl Mp4Box for TrafBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/trak.rs b/src/mp4box/trak.rs index e8ae760..e0c286a 100644 --- a/src/mp4box/trak.rs +++ b/src/mp4box/trak.rs @@ -44,7 +44,7 @@ impl Mp4Box for TrakBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/trex.rs b/src/mp4box/trex.rs index 2694fd6..2a45861 100644 --- a/src/mp4box/trex.rs +++ b/src/mp4box/trex.rs @@ -35,7 +35,7 @@ impl Mp4Box for TrexBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/trun.rs b/src/mp4box/trun.rs index efbb2b0..793d53d 100644 --- a/src/mp4box/trun.rs +++ b/src/mp4box/trun.rs @@ -69,7 +69,7 @@ impl Mp4Box for TrunBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/tx3g.rs b/src/mp4box/tx3g.rs index d696315..7edcc34 100644 --- a/src/mp4box/tx3g.rs +++ b/src/mp4box/tx3g.rs @@ -62,7 +62,7 @@ impl Mp4Box for Tx3gBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/udta.rs b/src/mp4box/udta.rs index 9daec17..3fb40b4 100644 --- a/src/mp4box/udta.rs +++ b/src/mp4box/udta.rs @@ -35,7 +35,7 @@ impl Mp4Box for UdtaBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/vmhd.rs b/src/mp4box/vmhd.rs index 31f24b2..3eb8c9f 100644 --- a/src/mp4box/vmhd.rs +++ b/src/mp4box/vmhd.rs @@ -39,7 +39,7 @@ impl Mp4Box for VmhdBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/vp09.rs b/src/mp4box/vp09.rs index 0f88dd1..099339f 100644 --- a/src/mp4box/vp09.rs +++ b/src/mp4box/vp09.rs @@ -75,7 +75,7 @@ impl Mp4Box for Vp09Box { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result { diff --git a/src/mp4box/vpcc.rs b/src/mp4box/vpcc.rs index c9861c6..f3beaf2 100644 --- a/src/mp4box/vpcc.rs +++ b/src/mp4box/vpcc.rs @@ -32,7 +32,7 @@ impl Mp4Box for VpccBox { } fn to_json(&self) -> Result { - Ok(serde_json::to_string(&self).unwrap()) + serde_json::to_string(&self).map_err(|e| crate::error::Error::IoError(e.into())) } fn summary(&self) -> Result {