Skip to content
Snippets Groups Projects
Commit ab263374 authored by Jonas SPRENGER's avatar Jonas SPRENGER
Browse files

[ref] conf: add comment "cannot use macro fatal_error!"

parent 84535270
No related branches found
No related tags found
1 merge request!141Jonas/127 replace all panics by fatal error
...@@ -417,6 +417,7 @@ impl DuniterKeyPairs { ...@@ -417,6 +417,7 @@ impl DuniterKeyPairs {
} }
} }
// Warning: This function cannot use the macro fatal_error! because the logger is not yet initialized, so it must use panic !
fn generate_random_keypair(algo: KeysAlgo) -> KeyPairEnum { fn generate_random_keypair(algo: KeysAlgo) -> KeyPairEnum {
let mut rng = rand::thread_rng(); let mut rng = rand::thread_rng();
match algo { match algo {
...@@ -462,6 +463,7 @@ pub fn get_conf_path(profile_path: &PathBuf) -> PathBuf { ...@@ -462,6 +463,7 @@ pub fn get_conf_path(profile_path: &PathBuf) -> PathBuf {
} }
/// Returns the path to the folder containing the user data of the running profile /// Returns the path to the folder containing the user data of the running profile
// Warning: This function cannot use the macro fatal_error! because the logger is not yet initialized, so it must use panic !
pub fn get_profile_path(profiles_path: &Option<PathBuf>, profile_name: &str) -> PathBuf { pub fn get_profile_path(profiles_path: &Option<PathBuf>, profile_name: &str) -> PathBuf {
// Define and create datas directory if not exist // Define and create datas directory if not exist
let profiles_path: PathBuf = if let Some(profiles_path) = profiles_path { let profiles_path: PathBuf = if let Some(profiles_path) = profiles_path {
...@@ -520,6 +522,7 @@ pub fn load_conf( ...@@ -520,6 +522,7 @@ pub fn load_conf(
} }
/// Load configuration. at specified path /// Load configuration. at specified path
// Warning: This function cannot use the macro fatal_error! because the logger is not yet initialized, so it must use panic !
pub fn load_conf_at_path( pub fn load_conf_at_path(
profile_path: PathBuf, profile_path: PathBuf,
keypairs_file_path: &Option<PathBuf>, keypairs_file_path: &Option<PathBuf>,
...@@ -649,6 +652,7 @@ pub fn load_conf_at_path( ...@@ -649,6 +652,7 @@ pub fn load_conf_at_path(
} }
/// Save keypairs in profile folder /// Save keypairs in profile folder
// Warning: This function cannot use the macro fatal_error! because the logger is not yet initialized, so it must use panic !
pub fn write_keypairs_file( pub fn write_keypairs_file(
file_path: &PathBuf, file_path: &PathBuf,
keypairs: &DuniterKeyPairs, keypairs: &DuniterKeyPairs,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment