Skip to content

Commit ad3cabb

Browse files
authored
Merge pull request #417 from filecoin-project/dont-leak-cbor-error
fix: don't leak underlying library error
2 parents bf6a397 + d3c7174 commit ad3cabb

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

ipld/car/src/error.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub enum Error {
1313
#[error("Io error: {0}")]
1414
Io(#[from] std::io::Error),
1515
#[error("Cbor encoding error: {0}")]
16-
Cbor(#[from] fvm_shared::encoding::error::Error),
16+
Cbor(#[from] fvm_shared::encoding::Error),
1717
#[error("CAR error: {0}")]
1818
Other(String),
1919
}

shared/src/encoding/cbor.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub const DAG_CBOR: u64 = 0x71;
1717
pub trait Cbor: ser::Serialize + de::DeserializeOwned {
1818
/// Marshalls cbor encodable object into cbor bytes
1919
fn marshal_cbor(&self) -> Result<Vec<u8>, Error> {
20-
Ok(to_vec(&self)?)
20+
to_vec(&self)
2121
}
2222

2323
/// Unmarshals cbor encoded bytes to object

shared/src/encoding/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ mod vec;
99

1010
pub use serde::{de, ser};
1111
pub use serde_bytes;
12-
pub use serde_ipld_dagcbor::{error, from_reader, from_slice, to_writer};
12+
pub use serde_ipld_dagcbor::{from_reader, from_slice, to_writer};
1313

1414
pub use self::bytes::*;
1515
pub use self::cbor::*;
@@ -32,7 +32,7 @@ pub mod repr {
3232
// TODO: upstream this. Upstream doesn't allow encoding unsized types (e.g., slices).
3333

3434
/// Serializes a value to a vector.
35-
pub fn to_vec<T>(value: &T) -> serde_ipld_dagcbor::Result<Vec<u8>>
35+
pub fn to_vec<T>(value: &T) -> Result<Vec<u8>, Error>
3636
where
3737
T: ser::Serialize + ?Sized,
3838
{

0 commit comments

Comments
 (0)