summaryrefslogtreecommitdiff
path: root/src/spec.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/spec.rs')
-rw-r--r--src/spec.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/spec.rs b/src/spec.rs
index b9828e9..a1d1c2f 100644
--- a/src/spec.rs
+++ b/src/spec.rs
@@ -216,14 +216,14 @@ pub enum SpecificationError {
#[error("No SSH authorized keys specified for {0} and no default configured")]
NoAuthorizedKeys(String),
+ /// Error reading specification file.
+ #[error("Couldn't read specification file {0}")]
+ Read(PathBuf, #[source] std::io::Error),
+
/// Error reading SSH public key.
#[error("Failed to read SSH public key file {0}")]
SshKeyRead(PathBuf, #[source] std::io::Error),
- /// I/O error.
- #[error(transparent)]
- IoError(#[from] std::io::Error),
-
/// Error parsing string as UTF8.
#[error(transparent)]
FromUtf8Error(#[from] std::string::FromUtf8Error),
@@ -247,7 +247,8 @@ impl Specification {
filename: &Path,
) -> Result<Vec<Specification>, SpecificationError> {
debug!("reading specification from {}", filename.display());
- let spec = fs::read(filename)?;
+ let spec = fs::read(filename)
+ .map_err(|err| SpecificationError::Read(filename.to_path_buf(), err))?;
let input: HashMap<String, OneVmInputSpecification> = serde_yaml::from_slice(&spec)?;
debug!("specification as read from file: {:#?}", input);