Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change 'unwrap' usage to '?' operator in controller/src/command.rs #104

Merged
merged 2 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions controller/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ where
let method = args.method.as_str();
let mut slate;
if method == "emoji" {
slate = EmojiSlate().decode(&args.input.as_str()).unwrap();
slate = EmojiSlate().decode(&args.input.as_str())?;
} else {
slate = PathToSlate((&args.input).into()).get_tx()?;
}
Expand Down Expand Up @@ -889,7 +889,7 @@ where
return Ok(());
}
Some(f) => {
let mut tx_file = File::create(f.clone()).unwrap();
let mut tx_file = File::create(f.clone())?;
tx_file.write_all(json::to_string(&stored_tx).unwrap().as_bytes())?;
tx_file.sync_all()?;
info!("Dumped transaction data for tx {} to {}", args.id, f);
Expand Down Expand Up @@ -1038,7 +1038,7 @@ where
match result {
Ok(p) => {
// actually export proof
let mut proof_file = File::create(args.output_file.clone()).unwrap();
let mut proof_file = File::create(args.output_file.clone())?;
proof_file.write_all(json::to_string_pretty(&p).unwrap().as_bytes())?;
proof_file.sync_all()?;
warn!("Payment proof exported to {}", args.output_file);
Expand Down
6 changes: 2 additions & 4 deletions impls/src/backends/lmdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -588,8 +588,7 @@ where
.borrow()
.as_ref()
.unwrap()
.put_ser(&key, Serializable::OutputData(out))
.unwrap();
.put_ser(&key, Serializable::OutputData(out))?;
}

Ok(())
Expand Down Expand Up @@ -817,8 +816,7 @@ where
.borrow()
.as_ref()
.unwrap()
.put_ser(&tx_log_key, Serializable::TxLogEntry(tx_in))
.unwrap();
.put_ser(&tx_log_key, Serializable::TxLogEntry(tx_in))?;
Ok(())
}

Expand Down
Loading