diff --git a/lib/clif-backend/src/signal/windows.rs b/lib/clif-backend/src/signal/windows.rs index ec1c82e9c64..7d3e81d695f 100644 --- a/lib/clif-backend/src/signal/windows.rs +++ b/lib/clif-backend/src/signal/windows.rs @@ -71,13 +71,17 @@ pub fn call_protected( TrapCode::HeapOutOfBounds => ExceptionCode::MemoryOutOfBounds, TrapCode::TableOutOfBounds => ExceptionCode::CallIndirectOOB, TrapCode::UnreachableCodeReached => ExceptionCode::Unreachable, - _ => ExceptionCode::Unknown, + _ => return Err(CallProtError(Box::new("unknown trap code".to_string()))), }, - EXCEPTION_STACK_OVERFLOW => ExceptionCode::Unknown, + EXCEPTION_STACK_OVERFLOW => ExceptionCode::MemoryOutOfBounds, EXCEPTION_INT_DIVIDE_BY_ZERO | EXCEPTION_INT_OVERFLOW => { ExceptionCode::IllegalArithmetic } - _ => ExceptionCode::Unknown, + _ => { + return Err(CallProtError(Box::new( + "unknown exception code".to_string(), + ))) + } }))) } else { let signal = match code as DWORD { diff --git a/lib/spectests/tests/semantics.rs b/lib/spectests/tests/semantics.rs index bdec931ede7..2edfa7cd1c4 100644 --- a/lib/spectests/tests/semantics.rs +++ b/lib/spectests/tests/semantics.rs @@ -30,10 +30,8 @@ mod tests { match result { Err(err) => match err { CallError::Runtime(RuntimeError(e)) => { - let exc_code = e - .downcast::() + e.downcast::() .expect("expecting exception code"); - assert!(exc_code != ExceptionCode::Unknown); } _ => unimplemented!(), }, diff --git a/lib/spectests/tests/spectest.rs b/lib/spectests/tests/spectest.rs index 5f8921613bd..f8b7939f372 100644 --- a/lib/spectests/tests/spectest.rs +++ b/lib/spectests/tests/spectest.rs @@ -690,7 +690,7 @@ mod tests { } CallError::Runtime(RuntimeError(e)) => { use wasmer_runtime::ExceptionCode; - if let Some(_) = data.downcast_ref::() { + if let Some(_) = e.downcast_ref::() { test_report.count_passed(); } else { test_report.add_failure( @@ -699,8 +699,7 @@ mod tests { line, kind: format!("{}", "AssertTrap"), message: format!( - "expected trap, got Runtime:Error {:?}", - r + "expected trap, got RuntimeError" ), }, &test_key,