Skip to content

Commit

Permalink
Fail if no manifests were found while validating a directory
Browse files Browse the repository at this point in the history
  • Loading branch information
hoijui committed Dec 21, 2023
1 parent 09acc93 commit e3abcb9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,16 +212,16 @@ where
} else {
validation::okh_losh_toml
};
let mut total_res = Ok(());
let mut total_res = Err(validation::Error::NoManifestsFound);
for input_file in dir::iter_exts(dir::walker(input_path, recursive), ext_matcher) {
if let Some(input_file_name) = input_file.file_name() {
if !file_matcher.is_match(&input_file_name.to_string_lossy()) {
continue;
}
let res = validator(input_file.clone());
if let Err(err) = res {
total_res = validator(input_file.clone());
if let Err(err) = &total_res {
log::warn!("File: '{}'\n{}", input_file.display(), &err);
total_res = Err(err); // TODO FIXME We need a simple "Not all succeeded" indicator error here!
// TODO FIXME We need a simple "Not all succeeded" indicator error here!
if !cont {
break;
}
Expand Down
3 changes: 3 additions & 0 deletions src/validation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ const SCHEMA_OKH_V1: &str = include_str!(concat!(

#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("Failed to find any manifests.")]
NoManifestsFound,

#[error("Failed to read or write, probably from/to the file-system.")]
Io(#[from] std::io::Error),

Expand Down

0 comments on commit e3abcb9

Please sign in to comment.