Skip to content

Commit e91f5c4

Browse files
committed
cmd(snip): explicit error
1 parent 9915f92 commit e91f5c4

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
@@ -216,19 +216,21 @@ impl From<toml::de::Error> for Error {
216216
}
217217
}
218218

219+
/// wasm-snip occurs error when trying to print out the result.
219220
impl From<parity_wasm::elements::Error> for Error {
220221
fn from(error: parity_wasm::elements::Error) -> Self {
221222
Error::Cli {
222-
message: format!("{}", "There was an output Error"),
223+
message: "There was an wasm-snip output Error".to_owned(),
223224
stderr: format!("{}", error),
224225
}
225226
}
226227
}
227228

229+
/// wasm-snip occurs error when working with inputs.
228230
impl From<failure::Error> for Error {
229231
fn from(error: failure::Error) -> Self {
230232
Error::Cli {
231-
message: format!("{}", "There was an wasm-snip Error"),
233+
message: "There was an wasm-snip Error".to_owned(),
232234
stderr: format!("{}", error),
233235
}
234236
}

0 commit comments

Comments
 (0)