Improve Error

This commit is contained in:
2022-09-19 21:06:44 +02:00
parent 80c6271d0d
commit e79df423b0
5 changed files with 64 additions and 37 deletions

View File

@@ -19,5 +19,5 @@ pub struct Arguments {
pub fn convert(_args: Arguments, input: Input, _output: Output) -> Result<(), Error> {
ImageReader::new(Cursor::new(tool_helper::input_to_vec(input)?));
Err(Error::new("Convert not implemented yet".to_owned(), Some(-2)))
Err(Error::not_implemented("convert"))
}

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))
}
}