Skip to content

Commit

Permalink
fix(scheduler): Give more error info when a file cannot be accessed (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
boxbeam authored Jan 24, 2024
1 parent 22e0175 commit b9fea98
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion crates/llama-cpp-bindings/llama.cpp
Submodule llama.cpp updated 244 files
31 changes: 17 additions & 14 deletions crates/tabby-scheduler/src/dataset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,23 @@ impl RepositoryExt for RepositoryConfig {
let language = get_language(relative_path.extension().unwrap())
.unwrap()
.to_owned();
if let Ok(file_content) = read_to_string(entry.path()) {
let source_file = SourceFile {
git_url: self.git_url.clone(),
filepath: relative_path.display().to_string(),
max_line_length: metrics::max_line_length(&file_content),
avg_line_length: metrics::avg_line_length(&file_content),
alphanum_fraction: metrics::alphanum_fraction(&file_content),
tags: tags::collect(&mut context, &language, &file_content),
language,
content: file_content,
};
writer.write_json_lines([source_file])?;
} else {
error!("Cannot read {:?}", relative_path);
match read_to_string(entry.path()) {
Ok(file_content) => {
let source_file = SourceFile {
git_url: self.git_url.clone(),
filepath: relative_path.display().to_string(),
max_line_length: metrics::max_line_length(&file_content),
avg_line_length: metrics::avg_line_length(&file_content),
alphanum_fraction: metrics::alphanum_fraction(&file_content),
tags: tags::collect(&mut context, &language, &file_content),
language,
content: file_content,
};
writer.write_json_lines([source_file])?;
}
Err(e) => {
error!("Cannot read {relative_path:?}: {e:?}");
}
}
}

Expand Down

0 comments on commit b9fea98

Please sign in to comment.