diff --git a/src/any.rs b/src/any.rs index 7cc67870..10133b43 100644 --- a/src/any.rs +++ b/src/any.rs @@ -643,7 +643,7 @@ impl Dynamic { }; #[cfg(feature = "no_closure")] - panic!("'no_closure' feature does not support converting into a shared value"); + panic!("converting into a shared value is not supported under 'no_closure'"); } /// Convert the `Dynamic` value into specific type. @@ -812,7 +812,7 @@ impl Dynamic { self.try_cast::().unwrap_or_else(|| { panic!( - "value is {} and cannot be cast to {}", + "cannot cast {} value and to {}", self_type_name, type_name::() ) diff --git a/src/module/resolvers/collection.rs b/src/module/resolvers/collection.rs index b8cc2729..e513f51e 100644 --- a/src/module/resolvers/collection.rs +++ b/src/module/resolvers/collection.rs @@ -70,8 +70,13 @@ impl ModuleResolver for ModuleResolversCollection { pos: Position, ) -> Result> { for resolver in self.0.iter() { - if let Ok(module) = resolver.resolve(engine, path, pos) { - return Ok(module); + match resolver.resolve(engine, path, pos) { + Ok(module) => return Ok(module), + Err(err) => match *err { + EvalAltResult::ErrorModuleNotFound(_, _) => continue, + EvalAltResult::ErrorInModule(_, err, _) => return Err(err), + _ => panic!("ModuleResolver::resolve returns error that is not ErrorModuleNotFound or ErrorInModule"), + }, } }