cob: Don't panic on missing root
This can happen if the change was not able to be loaded due to open file limit issues for example.
This commit is contained in:
parent
ccc675b304
commit
44fc11dff8
|
|
@ -17,6 +17,8 @@ pub enum EvaluateError {
|
||||||
Init(Box<dyn std::error::Error + Sync + Send + 'static>),
|
Init(Box<dyn std::error::Error + Sync + Send + 'static>),
|
||||||
#[error("invalid signature for entry '{0}'")]
|
#[error("invalid signature for entry '{0}'")]
|
||||||
Signature(EntryId),
|
Signature(EntryId),
|
||||||
|
#[error("root entry '{0}' missing from graph")]
|
||||||
|
MissingRoot(EntryId),
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The graph of changes for a particular collaborative object
|
/// The graph of changes for a particular collaborative object
|
||||||
|
|
@ -100,7 +102,7 @@ impl ChangeGraph {
|
||||||
let root = self
|
let root = self
|
||||||
.graph
|
.graph
|
||||||
.get(&root)
|
.get(&root)
|
||||||
.expect("ChangeGraph::evaluate: root must be part of change graph");
|
.ok_or(EvaluateError::MissingRoot(root))?;
|
||||||
|
|
||||||
if !root.valid_signatures() {
|
if !root.valid_signatures() {
|
||||||
return Err(EvaluateError::Signature(root.id));
|
return Err(EvaluateError::Signature(root.id));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue