bundle2-resolver: add context to errors when decoding filelogs

Summary: more context, better errors

Reviewed By: farnz

Differential Revision: D8298947

fbshipit-source-id: bc950ca39b8fc010f3a225f0810e13f62d6efa24
This commit is contained in:
Lukas Piatkowski 2018-06-08 04:53:02 -07:00 committed by Facebook Github Bot
parent c90ee251ab
commit 5220fc66de
2 changed files with 23 additions and 12 deletions

View File

@ -123,18 +123,29 @@ where
delta_cache
.decode(node.clone(), base.into_option(), delta)
.and_then(move |data| {
Ok(Filelog {
node_key: HgNodeKey {
path: RepoPath::FilePath(path),
hash: node,
},
p1: p1.into_option(),
p2: p2.into_option(),
linknode,
data,
})
.and_then({
let node = node.clone();
let path = path.clone();
move |data| {
Ok(Filelog {
node_key: HgNodeKey {
path: RepoPath::FilePath(path),
hash: node,
},
p1: p1.into_option(),
p2: p2.into_option(),
linknode,
data,
})
}
})
.with_context(move |_| {
format!(
"While decoding delta cache for file id {}, path {}",
node, path
)
})
.from_err()
.boxify()
})
.boxify()

View File

@ -4,7 +4,7 @@
// This software may be used and distributed according to the terms of the
// GNU General Public License version 2 or any later version.
pub use failure::{Error, Result, ResultExt};
pub use failure::prelude::*;
use mercurial_types::HgNodeHash;