mirror of
https://github.com/fluencelabs/parity-wasm
synced 2025-06-03 10:01:39 +00:00
Rename Initialization error to Instatiation
This commit is contained in:
parent
9dd7a5dfaf
commit
afb33d6f16
@ -42,8 +42,9 @@ pub enum Error {
|
||||
Program(String),
|
||||
/// Validation error.
|
||||
Validation(String),
|
||||
/// Initialization error.
|
||||
Initialization(String),
|
||||
/// Error while instantiating a module. Might occur when provided
|
||||
/// with incorrect exports (i.e. linkage failure).
|
||||
Instatiation(String),
|
||||
/// Function-level error.
|
||||
Function(String),
|
||||
/// Table-level error.
|
||||
@ -75,7 +76,7 @@ impl Into<String> for Error {
|
||||
match self {
|
||||
Error::Program(s) => s,
|
||||
Error::Validation(s) => s,
|
||||
Error::Initialization(s) => s,
|
||||
Error::Instatiation(s) => s,
|
||||
Error::Function(s) => s,
|
||||
Error::Table(s) => s,
|
||||
Error::Memory(s) => s,
|
||||
@ -97,7 +98,7 @@ impl ::std::fmt::Display for Error {
|
||||
match *self {
|
||||
Error::Program(ref s) => write!(f, "Program: {}", s),
|
||||
Error::Validation(ref s) => write!(f, "Validation: {}", s),
|
||||
Error::Initialization(ref s) => write!(f, "Initialization: {}", s),
|
||||
Error::Instatiation(ref s) => write!(f, "Instatiation: {}", s),
|
||||
Error::Function(ref s) => write!(f, "Function: {}", s),
|
||||
Error::Table(ref s) => write!(f, "Table: {}", s),
|
||||
Error::Memory(ref s) => write!(f, "Memory: {}", s),
|
||||
|
@ -167,7 +167,7 @@ impl<St> ModuleInstance<St> {
|
||||
.map(|is| is.entries())
|
||||
.unwrap_or(&[]);
|
||||
if imports.len() != extern_vals.len() {
|
||||
return Err(Error::Initialization(format!(
|
||||
return Err(Error::Instatiation(format!(
|
||||
"extern_vals length is not equal to import section entries"
|
||||
)));
|
||||
}
|
||||
@ -181,7 +181,7 @@ impl<St> ModuleInstance<St> {
|
||||
.expect("Due to validation function type should exists");
|
||||
let actual_fn_type = func.func_type();
|
||||
if expected_fn_type != actual_fn_type {
|
||||
return Err(Error::Initialization(format!(
|
||||
return Err(Error::Instatiation(format!(
|
||||
"Expected function with type {:?}, but actual type is {:?} for entry {}",
|
||||
expected_fn_type,
|
||||
actual_fn_type,
|
||||
@ -200,7 +200,7 @@ impl<St> ModuleInstance<St> {
|
||||
}
|
||||
(&External::Global(ref gl), &ExternVal::Global(ref global)) => {
|
||||
if gl.content_type() != global.value_type() {
|
||||
return Err(Error::Initialization(format!(
|
||||
return Err(Error::Instatiation(format!(
|
||||
"Expect global with {:?} type, but provided global with {:?} type",
|
||||
gl.content_type(),
|
||||
global.value_type(),
|
||||
@ -209,7 +209,7 @@ impl<St> ModuleInstance<St> {
|
||||
instance.push_global(Rc::clone(global))
|
||||
}
|
||||
(expected_import, actual_extern_val) => {
|
||||
return Err(Error::Initialization(format!(
|
||||
return Err(Error::Instatiation(format!(
|
||||
"Expected {:?} type, but provided {:?} extern_val",
|
||||
expected_import,
|
||||
actual_extern_val
|
||||
@ -369,7 +369,7 @@ impl<St> ModuleInstance<St> {
|
||||
let module_name = import_entry.module();
|
||||
let field_name = import_entry.field();
|
||||
let resolver = imports.resolver(module_name).ok_or_else(|| {
|
||||
Error::Initialization(format!("Module {} not found", module_name))
|
||||
Error::Instatiation(format!("Module {} not found", module_name))
|
||||
})?;
|
||||
let extern_val = match *import_entry.external() {
|
||||
External::Function(fn_ty_idx) => {
|
||||
@ -600,7 +600,7 @@ fn eval_init_expr<T>(init_expr: &InitExpr, module: &ModuleInstance<T>) -> Runtim
|
||||
|
||||
fn match_limits(l1: &ResizableLimits, l2: &ResizableLimits) -> Result<(), Error> {
|
||||
if l1.initial() < l2.initial() {
|
||||
return Err(Error::Initialization(format!(
|
||||
return Err(Error::Instatiation(format!(
|
||||
"trying to import with limits l1.initial={} and l2.initial={}",
|
||||
l1.initial(),
|
||||
l2.initial()
|
||||
@ -611,7 +611,7 @@ fn match_limits(l1: &ResizableLimits, l2: &ResizableLimits) -> Result<(), Error>
|
||||
(_, None) => (),
|
||||
(Some(m1), Some(m2)) if m1 <= m2 => (),
|
||||
_ => {
|
||||
return Err(Error::Initialization(format!(
|
||||
return Err(Error::Instatiation(format!(
|
||||
"trying to import with limits l1.max={:?} and l2.max={:?}",
|
||||
l1.maximum(),
|
||||
l2.maximum()
|
||||
|
@ -379,7 +379,7 @@ fn memory_import_limits_initial() {
|
||||
.build();
|
||||
match program.add_module("client", client_module, &mut ()).map(|_| ()) {
|
||||
Ok(_) if !is_error => (),
|
||||
Err(Error::Initialization(_)) if is_error => (),
|
||||
Err(Error::Instatiation(_)) if is_error => (),
|
||||
x @ _ => panic!("unexpected result for test_case {:?}: {:?}", test_case, x),
|
||||
}
|
||||
}
|
||||
@ -411,7 +411,7 @@ fn memory_import_limits_maximum() {
|
||||
|
||||
program.add_module("core", core_module, &mut ()).unwrap();
|
||||
match program.add_module("client", client_module, &mut ()).map(|_| ()) {
|
||||
Err(Error::Initialization(actual_err)) => match expected_err {
|
||||
Err(Error::Instatiation(actual_err)) => match expected_err {
|
||||
MaximumError::ValueMismatch
|
||||
if actual_err == format!("trying to import with limits l1.max={:?} and l2.max={:?}", core_maximum, client_maximum) => (),
|
||||
_ => panic!("unexpected validation error for test_case {:?}: {}", test_case, actual_err),
|
||||
@ -445,7 +445,7 @@ fn table_import_limits_initial() {
|
||||
.build();
|
||||
match program.add_module("client", client_module, &mut ()).map(|_| ()) {
|
||||
Ok(_) if !is_error => (),
|
||||
Err(Error::Initialization(ref actual_error))
|
||||
Err(Error::Instatiation(ref actual_error))
|
||||
if is_error && actual_error == &format!("trying to import with limits l1.initial=10 and l2.initial={}", import_initial) => (),
|
||||
x @ _ => panic!("unexpected result for test_case {:?}: {:?}", test_case, x),
|
||||
}
|
||||
@ -478,7 +478,7 @@ fn table_import_limits_maximum() {
|
||||
|
||||
program.add_module("core", core_module, &mut ()).unwrap();
|
||||
match program.add_module("client", client_module, &mut ()).map(|_| ()) {
|
||||
Err(Error::Initialization(actual_err)) => match expected_err {
|
||||
Err(Error::Instatiation(actual_err)) => match expected_err {
|
||||
MaximumError::ValueMismatch
|
||||
if actual_err == format!("trying to import with limits l1.max={:?} and l2.max={:?}", core_maximum, client_maximum) => (),
|
||||
_ => panic!("unexpected validation error for test_case {:?}: {}", test_case, actual_err),
|
||||
|
Loading…
x
Reference in New Issue
Block a user