pub enum ManifestError {
Missing {
manifest_path: PathBuf,
},
Unreadable {
manifest_path: PathBuf,
message: String,
},
Malformed {
manifest_path: PathBuf,
message: String,
},
InvalidName {
manifest_path: PathBuf,
name: String,
},
InvalidVersion {
manifest_path: PathBuf,
version: String,
},
InvalidDependencyName {
manifest_path: PathBuf,
table: &'static str,
name: String,
},
InvalidDependencyEntry {
manifest_path: PathBuf,
table: &'static str,
package: String,
reason: String,
},
DependencyListedTwice {
manifest_path: PathBuf,
name: String,
},
PrivateModuleNotFound {
manifest_path: PathBuf,
name: Name,
},
MainModuleNotFound {
manifest_path: PathBuf,
name: Name,
},
}Expand description
Every way reading a manifest can fail.
Like SourceFileError, a manifest error has no
Span to render: the location it would want is a byte range in
zelkova.toml, which is not a file the SourceFiles database
holds. Every variant therefore carries the manifest_path it was found in, so that its
message can name the file on its own — which is the whole of the
location a reader gets, and is why every variant but
PrivateModuleNotFound and
MainModuleNotFound goes back to the caller
unrendered, the same way loading errors already do.
Variants§
Missing
No zelkova.toml at all beside src/.
Unreadable
zelkova.toml exists but could not be read (permissions, not a regular file, …).
Malformed
zelkova.toml is not well-formed TOML, or does not have the shape RawManifest
expects — a missing required field among them.
InvalidName
name is not ASCII lowercase letters, digits and hyphens, starting with a letter,
with every hyphen followed by a letter.
InvalidVersion
version is not exactly three non-negative integers separated by dots.
InvalidDependencyName
A key of dependencies or test-dependencies is not a legal package name.
InvalidDependencyEntry
An entry of dependencies or test-dependencies does not name exactly one source,
or pairs that source with a field it does not take.
DependencyListedTwice
One package name in both dependencies and test-dependencies — the spec allows a
name in at most one of the two.
PrivateModuleNotFound
private-modules names a module this package does not hold.
Unlike every other variant here, this one cannot be raised by load: knowing what
the package holds needs its sources loaded, which happens only after the manifest
has already been accepted. compile_package builds this once it has parsed every
module, and folds it into the normal per-package error accumulation rather than the
unrendered path the rest of this enum takes.
MainModuleNotFound
main names a module this package does not hold under src/ — a module under
tests/ does not count.
Raised after the package’s src/ has checked, for the same reason as
PrivateModuleNotFound, and by the check
program describes, whose other two failures are about the
module the name finds.