Use type alias for error.

This commit is contained in:
Stephen Chung
2021-12-27 12:27:31 +08:00
parent e7ca3f41dd
commit 05d4c81e7a
29 changed files with 293 additions and 378 deletions

View File

@@ -3,9 +3,7 @@
use crate::engine::{EvalState, Imports};
use crate::parser::ParseState;
use crate::types::dynamic::Variant;
use crate::{
Dynamic, Engine, EvalAltResult, Module, Position, RhaiResult, RhaiResultOf, Scope, AST,
};
use crate::{Dynamic, Engine, Module, Position, RhaiResult, RhaiResultOf, Scope, AST, ERR};
use std::any::type_name;
#[cfg(feature = "no_std")]
use std::prelude::v1::*;
@@ -193,7 +191,7 @@ impl Engine {
let typ = self.map_type_name(result.type_name());
result.try_cast::<T>().ok_or_else(|| {
EvalAltResult::ErrorMismatchOutputType(
ERR::ErrorMismatchOutputType(
self.map_type_name(type_name::<T>()).into(),
typ.into(),
Position::NONE,