Skip to content

Commit 1ca1dfb

Browse files
author
replydev
committed
Print errors in stderr
1 parent a58d246 commit 1ca1dfb

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/argument_functions.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub fn import(args: Vec<String>){
3535
match result {
3636
Ok(result) => elements = result,
3737
Err(e) => {
38-
println!("An error occurred: {}", e);
38+
eprintln!("An error occurred: {}", e);
3939
return;
4040
}
4141
}
@@ -45,7 +45,7 @@ pub fn import(args: Vec<String>){
4545
println!("Successfully imported database");
4646
},
4747
Err(e) => {
48-
println!("An error occurred during database overwriting: {}",e);
48+
eprintln!("An error occurred during database overwriting: {}",e);
4949
}
5050
}
5151
}
@@ -62,7 +62,7 @@ pub fn add(args: Vec<String>){
6262
if args.len() == 4{
6363
match database_loader::add_element(&prompt_for_passwords("Insert the secret: ",0),&args[2],&args[3]){
6464
Ok(()) => println!("Success"),
65-
Err(e) => println!("An error occurred: {}",e)
65+
Err(e) => eprintln!("An error occurred: {}",e)
6666
}
6767
}
6868
else{
@@ -76,7 +76,7 @@ pub fn remove(args: Vec<String>){
7676

7777
match database_loader::remove_element_from_db(id){
7878
Ok(()) => println!("Success"),
79-
Err(e) => println!("An error has occurred: {}",e)
79+
Err(e) => eprintln!("An error has occurred: {}",e)
8080
}
8181
}
8282
else{
@@ -92,7 +92,7 @@ pub fn edit(args: Vec<String>){
9292
let label = &args[4];
9393
match database_loader::edit_element(id, &secret, &issuer, &label){
9494
Ok(()) => println!("Success"),
95-
Err(e) => println!("An error occurred: {}",e)
95+
Err(e) => eprintln!("An error occurred: {}",e)
9696
}
9797
}
9898
else{
@@ -108,7 +108,7 @@ pub fn export(args: Vec<String>){
108108
println!("Database was successfully exported at {}", export_result);
109109
},
110110
Err(e) =>{
111-
println!("An error occured while exporting database: {}", e);
111+
eprintln!("An error occured while exporting database: {}", e);
112112
}
113113
}
114114
}
@@ -121,7 +121,7 @@ pub fn json(args: Vec<String>){
121121
if args.len() == 2{
122122
match otp_helper::get_json_results(){
123123
Ok(results) => println!("{}",results),
124-
Err(e) => println!("An error occurred while getting json result: {}",e),
124+
Err(e) => eprintln!("An error occurred while getting json result: {}",e),
125125
}
126126
}
127127
else{
@@ -140,7 +140,7 @@ pub fn single(args: Vec<String>){
140140
otp_helper::show_codes(&result);
141141
}
142142
},
143-
Err(e) => println!("An error occurred: {}",e)
143+
Err(e) => eprintln!("An error occurred: {}",e)
144144
}
145145
}
146146
else{

0 commit comments

Comments
 (0)