Skip to content

Commit

Permalink
fix: return error instead of panic when permission candidates file is…
Browse files Browse the repository at this point in the history
… missing (#440)
  • Loading branch information
LGLO authored Jan 31, 2025
1 parent 670af34 commit a4d5049
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,13 @@ impl UpsertPermissionedCandidatesCmd {

let mut permissioned_candidates = Vec::new();

for line in read_to_string(&self.permissioned_candidates_file)
.expect("Permissioned candidates file with each line representing one candidate")
.lines()
{
let file_content = read_to_string(&self.permissioned_candidates_file).map_err(|e| {
format!(
"Could not read permissioned candidates file '{}'. Cause: {e}",
&self.permissioned_candidates_file
)
})?;
for line in file_content.lines() {
if line.is_empty() {
continue;
}
Expand Down

0 comments on commit a4d5049

Please sign in to comment.