Improve Error

This commit is contained in:
Jaby
2022-09-19 21:06:44 +02:00
committed by Jaby
parent a5cfe87a69
commit 7f35413c9d
5 changed files with 64 additions and 37 deletions

View File

@@ -1,6 +1,7 @@
use jaby_engine_fconv::images::{*};
use clap::{Parser, Subcommand};
use std::path::PathBuf;
use tool_helper::Error;
#[derive(Parser)]
#[clap(about = "Converts files to various JabyEngine related file formats", long_about = None)]
@@ -20,7 +21,7 @@ enum SubCommands {
SimpleTIM(reduced_tim::Arguments)
}
fn run_main() -> tool_helper::Result<()> {
fn run_main() -> Result<(), Error> {
match CommandLine::try_parse() {
Ok(cmd) => {
let input = tool_helper::open_input(cmd.input_file)?;
@@ -30,7 +31,7 @@ fn run_main() -> tool_helper::Result<()> {
SubCommands::SimpleTIM(args) => reduced_tim::convert(args, input, output),
}
},
Err(error) => Err(tool_helper::Error::new(error.to_string(), None))
Err(error) => Err(Error::from_error(error))
}
}