mirror of
https://github.com/ivabus/feval
synced 2024-12-05 05:05:07 +03:00
Add error handling
This commit is contained in:
parent
3395521ec5
commit
3288601040
3 changed files with 7 additions and 3 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
@ -10,7 +10,7 @@ checksum = "aacfb566035f8cd02f6ec9247c242f3f9904a0b288ea383abcf4e95df6436a34"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "feval"
|
name = "feval"
|
||||||
version = "0.2.0"
|
version = "0.3.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"evalexpr",
|
"evalexpr",
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "feval"
|
name = "feval"
|
||||||
version = "0.2.0"
|
version = "0.3.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
description = "clt for fast evaluations"
|
description = "clt for fast evaluations"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
|
@ -30,7 +30,11 @@ fn main() {
|
||||||
match args.len() {
|
match args.len() {
|
||||||
2 => {
|
2 => {
|
||||||
let expr = all(args[1].clone());
|
let expr = all(args[1].clone());
|
||||||
println!("{}", evalexpr::eval(&expr).unwrap())
|
let result = evalexpr::eval(&expr.trim());
|
||||||
|
match result {
|
||||||
|
Ok(succ_res) => println!("{}", succ_res),
|
||||||
|
Err(err) => println!("Error: {}", err)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
1 => {main_loop()},
|
1 => {main_loop()},
|
||||||
_ => {
|
_ => {
|
||||||
|
|
Loading…
Reference in a new issue