| 69 | |
| 70 | impl From<LocalApplyError> for InsertError { |
| 71 | fn from(e: LocalApplyError) -> Self { |
| 72 | match e { |
| 73 | LocalApplyError::DependencyMissing { hash } => InsertError::MissingDependencies { |
| 74 | missing: vec![hash], |
| 75 | }, |
| 76 | LocalApplyError::ChangeAlreadyApplied { hash } => InsertError::AlreadyApplied { |
| 77 | hash: hash.to_base32(), |
| 78 | }, |
| 79 | LocalApplyError::CyclicDependency { message } => { |
| 80 | InsertError::CyclicDependency { message } |
| 81 | } |
| 82 | LocalApplyError::InvalidChange => InsertError::InvalidChange { |
| 83 | message: "Change format is invalid".to_string(), |
| 84 | }, |
| 85 | LocalApplyError::Corruption => InsertError::InvalidChange { |
| 86 | message: "Change data is corrupted".to_string(), |
| 87 | }, |
| 88 | other => InsertError::Internal(other.to_string()), |
| 89 | } |
| 90 | } |
| 91 | } |
| 92 | |
| 93 | /// Format a list of hashes for display. |