mirror of
https://github.com/TheM1Stery/izanami.git
synced 2025-04-19 16:31:11 +00:00
improve code
This commit is contained in:
parent
90f7755c0c
commit
164c18093b
17
src/main.rs
17
src/main.rs
@ -13,22 +13,19 @@ fn main() -> ExitCode {
|
||||
Ordering::Equal => {
|
||||
let result = run_file(args[1].to_str().unwrap());
|
||||
|
||||
if let Err(RunError::FileReadError(e)) = result {
|
||||
return match result {
|
||||
Err(RunError::FileReadError(e)) => {
|
||||
println!("Couldn't read the file. Reason: {}", e);
|
||||
return ExitCode::from(1);
|
||||
}
|
||||
if let Err(RunError::OtherError(e)) = result {
|
||||
Err(RunError::OtherError(e)) => {
|
||||
println!("Error occured. Error: {}", e);
|
||||
return ExitCode::from(75);
|
||||
}
|
||||
|
||||
if let Err(RunError::RuntimeError(_r)) = result {
|
||||
return ExitCode::from(70);
|
||||
}
|
||||
|
||||
if let Err(RunError::ParseError) = result {
|
||||
return ExitCode::from(75);
|
||||
}
|
||||
Err(RunError::RuntimeError(_)) => ExitCode::from(70),
|
||||
Err(RunError::ParseError) => ExitCode::from(75),
|
||||
Ok(_) => ExitCode::SUCCESS,
|
||||
};
|
||||
}
|
||||
Ordering::Less => {
|
||||
let result = run_prompt();
|
||||
|
Loading…
Reference in New Issue
Block a user