Skip to content

Commit 07f9cce

Browse files
committed
cmd(snip): explicit error
1 parent 27883d5 commit 07f9cce

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/command.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,9 @@ fn set_crate_path(path: Option<String>) -> String {
352352
}
353353

354354
fn snip(opts: SnipOpitons) -> Result<(), Error> {
355-
let opt = opts.clone();
356-
let module = wasm_snip::snip(opts.into())?;
355+
let module = wasm_snip::snip(opts.clone().into())?;
357356

358-
if let Some(output) = opt.output {
357+
if let Some(output) = opts.output {
359358
elements::serialize_to_file(output, module)?;
360359
} else {
361360
let stdout = ::std::io::stdout();

src/error.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,19 +69,21 @@ impl From<toml::de::Error> for Error {
6969
}
7070
}
7171

72+
/// wasm-snip occurs error when trying to print out the result.
7273
impl From<parity_wasm::elements::Error> for Error {
7374
fn from(error: parity_wasm::elements::Error) -> Self {
7475
Error::Cli {
75-
message: format!("{}", "There was an output Error"),
76+
message: "There was an wasm-snip output Error".to_owned(),
7677
stderr: format!("{}", error),
7778
}
7879
}
7980
}
8081

82+
/// wasm-snip occurs error when working with inputs.
8183
impl From<failure::Error> for Error {
8284
fn from(error: failure::Error) -> Self {
8385
Error::Cli {
84-
message: format!("{}", "There was an wasm-snip Error"),
86+
message: "There was an wasm-snip Error".to_owned(),
8587
stderr: format!("{}", error),
8688
}
8789
}

0 commit comments

Comments
 (0)