mirror of
https://github.com/TheM1Stery/izanami.git
synced 2025-04-20 00:41: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 => {
|
Ordering::Equal => {
|
||||||
let result = run_file(args[1].to_str().unwrap());
|
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);
|
println!("Couldn't read the file. Reason: {}", e);
|
||||||
return ExitCode::from(1);
|
return ExitCode::from(1);
|
||||||
}
|
}
|
||||||
if let Err(RunError::OtherError(e)) = result {
|
Err(RunError::OtherError(e)) => {
|
||||||
println!("Error occured. Error: {}", e);
|
println!("Error occured. Error: {}", e);
|
||||||
return ExitCode::from(75);
|
return ExitCode::from(75);
|
||||||
}
|
}
|
||||||
|
Err(RunError::RuntimeError(_)) => ExitCode::from(70),
|
||||||
if let Err(RunError::RuntimeError(_r)) = result {
|
Err(RunError::ParseError) => ExitCode::from(75),
|
||||||
return ExitCode::from(70);
|
Ok(_) => ExitCode::SUCCESS,
|
||||||
}
|
};
|
||||||
|
|
||||||
if let Err(RunError::ParseError) = result {
|
|
||||||
return ExitCode::from(75);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Ordering::Less => {
|
Ordering::Less => {
|
||||||
let result = run_prompt();
|
let result = run_prompt();
|
||||||
|
Loading…
Reference in New Issue
Block a user