pub enum PackError {
Show 14 variants
Io(Error),
Walk(Error),
NotADirectory(PathBuf),
BadPattern {
pattern: String,
message: String,
},
ManifestSerialize(Error),
ManifestParse(Error),
ManifestTooLarge {
limit: u64,
},
MissingManifest,
UnsupportedFormat {
found: u32,
supported: u32,
},
DestinationExists(PathBuf),
EscapingArchivePath(String),
EscapingManifestPath {
field: String,
value: String,
},
UnusableArchiveEntry {
path: String,
kind: String,
},
WriteThroughSymlink {
path: String,
via: PathBuf,
},
}Expand description
Errors produced by the pack module.
Variants§
Io(Error)
An I/O error while reading the project or writing the archive.
Walk(Error)
The tree walk failed (permission denied, vanished directory, cycle).
NotADirectory(PathBuf)
The given path is not a directory.
BadPattern
A configured glob could not be compiled.
Carries the offending pattern so a typo in [pack] points at itself
rather than silently matching nothing.
Fields
ManifestSerialize(Error)
The manifest could not be serialized.
ManifestParse(Error)
The manifest could not be parsed.
ManifestTooLarge
The manifest is larger than this build will read into memory.
Reading is what happens before the archive has been judged, so the archive cannot be the one deciding how much memory that takes. Compression makes the difference enormous: a small file expands into as much filler as its author cares to write.
MissingManifest
The archive did not begin with a pack.toml entry.
UnsupportedFormat
The archive was written by a newer pack format than this build reads.
Fields
DestinationExists(PathBuf)
The restore destination already exists and would be overwritten.
EscapingArchivePath(String)
An archive entry names a path that would land outside the restore
destination (.. or an absolute component).
A pack produced by this crate never contains such an entry, so one that does is not a pack with a blemish — it is not trustworthy at all, and the restore stops rather than extracting the rest of it.
EscapingManifestPath
A manifest field names a path that would land outside the restore destination.
The manifest travels in the archive, so its paths are the archive’s claims about the project just as much as the entry names are — worktree locations and symlink paths are all joined onto the destination. Checked with the same rule and refused the same way; the field is named because the value alone does not say which claim carried it.
Fields
UnusableArchiveEntry
An archive entry is of a type a restore will not materialize.
This crate’s writer produces directories, regular files and symlinks and
nothing else, so any other type came from another producer. Device
nodes and fifos are not project content, and a hard link names a file
the pack does not carry — see crate::restore::HardLinkRecord for why
that one is reported rather than followed.
Fields
WriteThroughSymlink
An archive entry would be written through a symlink, which would land it outside the restore destination.
The scan never descends into a symlinked directory, so a legitimate pack has no file entries underneath a link. An archive that routes a write through one is crafted, and the restore stops.
Trait Implementations§
Source§impl Error for PackError
impl Error for PackError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()