mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-26 22:10:52 +00:00
tree: consolidate read error variants
There isn't much difference between BackendError::ReadObject of file type and TreeMergeError::ReadError. They are both caused by the backend.
This commit is contained in:
parent
bfa43d16f9
commit
916014dc1e
1 changed files with 5 additions and 9 deletions
|
@ -24,7 +24,7 @@ use thiserror::Error;
|
||||||
use tracing::instrument;
|
use tracing::instrument;
|
||||||
|
|
||||||
use crate::backend::{
|
use crate::backend::{
|
||||||
BackendError, ConflictId, FileId, TreeEntriesNonRecursiveIterator, TreeEntry, TreeId, TreeValue,
|
BackendError, ConflictId, TreeEntriesNonRecursiveIterator, TreeEntry, TreeId, TreeValue,
|
||||||
};
|
};
|
||||||
use crate::files::MergeResult;
|
use crate::files::MergeResult;
|
||||||
use crate::matchers::{EverythingMatcher, Matcher};
|
use crate::matchers::{EverythingMatcher, Matcher};
|
||||||
|
@ -36,11 +36,6 @@ use crate::{backend, files};
|
||||||
|
|
||||||
#[derive(Debug, Error)]
|
#[derive(Debug, Error)]
|
||||||
pub enum TreeMergeError {
|
pub enum TreeMergeError {
|
||||||
#[error("Failed to read file with ID {} ", .file_id.hex())]
|
|
||||||
ReadError {
|
|
||||||
source: std::io::Error,
|
|
||||||
file_id: FileId,
|
|
||||||
},
|
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
BackendError(#[from] BackendError),
|
BackendError(#[from] BackendError),
|
||||||
}
|
}
|
||||||
|
@ -448,9 +443,10 @@ pub fn try_resolve_file_conflict(
|
||||||
store
|
store
|
||||||
.read_file(filename, file_id)?
|
.read_file(filename, file_id)?
|
||||||
.read_to_end(&mut content)
|
.read_to_end(&mut content)
|
||||||
.map_err(|err| TreeMergeError::ReadError {
|
.map_err(|err| BackendError::ReadObject {
|
||||||
source: err,
|
object_type: file_id.object_type(),
|
||||||
file_id: file_id.clone(),
|
hash: file_id.hex(),
|
||||||
|
source: err.into(),
|
||||||
})?;
|
})?;
|
||||||
Ok(content)
|
Ok(content)
|
||||||
})?;
|
})?;
|
||||||
|
|
Loading…
Reference in a new issue