mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 08:18:15 +03:00
segmented_changelog: expose inner error message in hash-to-location endpoint
Summary: Previously it just passes "failed to compute the common descendant and distance for X", the outmost layer (context) of the error to the client. Make it contain more messages about the inner error and heads explicitly. Reviewed By: StanislavGlebik Differential Revision: D31071741 fbshipit-source-id: ec4f161491e14ae0e0c422f5e92a3849a5a29b56
This commit is contained in:
parent
3ef445c0a6
commit
4e0140653c
@ -80,16 +80,21 @@ impl<'a> SegmentedChangelog for ReadOnlySegmentedChangelog<'a> {
|
|||||||
.into_iter()
|
.into_iter()
|
||||||
.filter_map(|(cs_id, dag_id)| {
|
.filter_map(|(cs_id, dag_id)| {
|
||||||
// We do not return an entry when the asked commit is a descendant of client_head.
|
// We do not return an entry when the asked commit is a descendant of client_head.
|
||||||
self.iddag
|
match self
|
||||||
|
.iddag
|
||||||
.to_first_ancestor_nth(dag_id, constraints.clone())
|
.to_first_ancestor_nth(dag_id, constraints.clone())
|
||||||
.with_context(|| {
|
{
|
||||||
format!(
|
// Preserve error message in server response by flatten the error.
|
||||||
"failed to compute the common descendant and distance for {}",
|
Err(e) => Err(format_err!(
|
||||||
cs_id
|
"failed to compute the common descendant and distance for {} with heads {:?}: {:?}",
|
||||||
)
|
cs_id,
|
||||||
})
|
&master_heads,
|
||||||
.map(|opt| opt.map(|(v, dist)| (cs_id, Location::new(v, dist))))
|
e
|
||||||
.transpose()
|
)),
|
||||||
|
Ok(v) => Ok(v),
|
||||||
|
}
|
||||||
|
.map(|opt| opt.map(|(v, dist)| (cs_id, Location::new(v, dist))))
|
||||||
|
.transpose()
|
||||||
})
|
})
|
||||||
.collect::<Result<HashMap<_, _>>>()?;
|
.collect::<Result<HashMap<_, _>>>()?;
|
||||||
let common_cs_ids = {
|
let common_cs_ids = {
|
||||||
|
Loading…
Reference in New Issue
Block a user