Fix error messages.

This commit is contained in:
Stephen Chung 2020-11-11 13:25:45 +08:00
parent 958762079e
commit 7b27dcdd62
2 changed files with 10 additions and 9 deletions

View File

@ -281,7 +281,7 @@ mod array_functions {
}) })
.map_err(|err| { .map_err(|err| {
Box::new(EvalAltResult::ErrorInFunctionCall( Box::new(EvalAltResult::ErrorInFunctionCall(
"filter".to_string(), "index_of".to_string(),
err, err,
NO_POS, NO_POS,
)) ))
@ -314,7 +314,7 @@ mod array_functions {
}) })
.map_err(|err| { .map_err(|err| {
Box::new(EvalAltResult::ErrorInFunctionCall( Box::new(EvalAltResult::ErrorInFunctionCall(
"filter".to_string(), "some".to_string(),
err, err,
NO_POS, NO_POS,
)) ))
@ -347,7 +347,7 @@ mod array_functions {
}) })
.map_err(|err| { .map_err(|err| {
Box::new(EvalAltResult::ErrorInFunctionCall( Box::new(EvalAltResult::ErrorInFunctionCall(
"filter".to_string(), "all".to_string(),
err, err,
NO_POS, NO_POS,
)) ))
@ -449,7 +449,7 @@ mod array_functions {
}) })
.map_err(|err| { .map_err(|err| {
Box::new(EvalAltResult::ErrorInFunctionCall( Box::new(EvalAltResult::ErrorInFunctionCall(
"reduce".to_string(), "reduce_rev".to_string(),
err, err,
NO_POS, NO_POS,
)) ))
@ -467,7 +467,7 @@ mod array_functions {
) -> Result<Dynamic, Box<EvalAltResult>> { ) -> Result<Dynamic, Box<EvalAltResult>> {
let mut result = initial.call_dynamic(ctx, None, []).map_err(|err| { let mut result = initial.call_dynamic(ctx, None, []).map_err(|err| {
Box::new(EvalAltResult::ErrorInFunctionCall( Box::new(EvalAltResult::ErrorInFunctionCall(
"reduce".to_string(), "reduce_rev".to_string(),
err, err,
NO_POS, NO_POS,
)) ))
@ -486,7 +486,7 @@ mod array_functions {
}) })
.map_err(|err| { .map_err(|err| {
Box::new(EvalAltResult::ErrorInFunctionCall( Box::new(EvalAltResult::ErrorInFunctionCall(
"reduce".to_string(), "reduce_rev".to_string(),
err, err,
NO_POS, NO_POS,
)) ))
@ -556,7 +556,7 @@ mod array_functions {
}) })
.map_err(|err| { .map_err(|err| {
Box::new(EvalAltResult::ErrorInFunctionCall( Box::new(EvalAltResult::ErrorInFunctionCall(
"filter".to_string(), "drain".to_string(),
err, err,
NO_POS, NO_POS,
)) ))
@ -615,7 +615,7 @@ mod array_functions {
}) })
.map_err(|err| { .map_err(|err| {
Box::new(EvalAltResult::ErrorInFunctionCall( Box::new(EvalAltResult::ErrorInFunctionCall(
"filter".to_string(), "retain".to_string(),
err, err,
NO_POS, NO_POS,
)) ))

View File

@ -73,7 +73,8 @@ fn test_fn_ptr() -> Result<(), Box<EvalAltResult>> {
"# "#
) )
.expect_err("should error"), .expect_err("should error"),
EvalAltResult::ErrorInFunctionCall(fn_name, err, _) if fn_name == "foo" && matches!(*err, EvalAltResult::ErrorUnboundThis(_)) EvalAltResult::ErrorInFunctionCall(fn_name, err, _)
if fn_name == "foo" && matches!(*err, EvalAltResult::ErrorUnboundThis(_))
)); ));
Ok(()) Ok(())