Skip to content

Commit

Permalink
Merge pull request #1 from birkin/fix
Browse files Browse the repository at this point in the history
updates panic messages
  • Loading branch information
birkin authored Jul 4, 2023
2 parents 78dbe04 + 95d17a2 commit 541285a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ fn manage_directory_entry( item: &serde_json::value::Value ) {
// debug!( "{}", format!("item from within manage_directory_entry, ``{:?}``", item) ); // yields (EG): item, ``Object({"path": String("/foo/the.log")})``

// -- get path String from json-dict-object
let path_rfrnc = item["path"].as_str().unwrap_or_else( || {panic!("problem reading path from json-obj -- ``{:?}``");} );
let path_value = &item["path"];
let path_rfrnc = path_value.as_str().unwrap_or_else(|| {
panic!("problem reading path from json-obj: {:?}", path_value);
});
// let zz: () = path_rfrnc; // yields: found `&str`
let path: String = path_rfrnc.into();
// let zz: () = path; // yields: found struct `std::string::String`
Expand Down Expand Up @@ -210,7 +213,8 @@ fn process_file( file_path: &str, file_name: &str, parent_path: &str ) {
_ => {
let err_message = "unexpected extension found".to_string();
error!( "{}", err_message );
panic!( err_message );
// panic!( err_message );
panic!( "{}", err_message );
}
};
debug!( "{}", format!("new_extension, ``{:?}``", new_extension) );
Expand All @@ -224,7 +228,8 @@ fn process_file( file_path: &str, file_name: &str, parent_path: &str ) {
let bytes_copied = fs::copy( file_path, destination_path ).unwrap_or_else( |err| {
let err_message = format!( "problem copying the file, ``{}``", err );
error!( "{}", err_message );
panic!( err_message );
// panic!( err_message );
panic!( "{}", err_message );
});
info!( "{}", format!("copied ``{:?}K``", (bytes_copied / 1024)) );

Expand All @@ -234,7 +239,8 @@ fn process_file( file_path: &str, file_name: &str, parent_path: &str ) {
let _empty_file = File::create(&path).unwrap_or_else( |err| {
let err_message = format!( "problem creating new empty file, ``{}``", err );
error!( "{}", err_message );
panic!( err_message );
// panic!( err_message );
panic!( "{}", err_message );
});
}

Expand Down

0 comments on commit 541285a

Please sign in to comment.