Repository: denoland/deno_core
Pull request #71 (2023-07-22 02:43:55)

fix: Update 'throw_type_error' to actual throw TypeError


Patch:
diff --git a/ops/op2/dispatch_slow.rs b/ops/op2/dispatch_slow.rs
index e50e0b4..c70bcb9 100644
--- a/ops/op2/dispatch_slow.rs
+++ b/ops/op2/dispatch_slow.rs
@@ -736,7 +736,7 @@ fn throw_type_error(
   Ok(gs_quote!(generator_state(deno_core, scope) => {
     #maybe_scope
     let msg = #deno_core::v8::String::new_from_one_byte(&mut #scope, #message.as_bytes(), #deno_core::v8::NewStringType::Normal).unwrap();
-    let exc = #deno_core::v8::Exception::error(&mut #scope, msg);
+    let exc = #deno_core::v8::Exception::type_error(&mut #scope, msg);
     #scope.throw_exception(exc);
     return;
   }))


Test patch:
diff --git a/ops/op2/test_cases/async/async_arg_return.out b/ops/op2/test_cases/async/async_arg_return.out
index d3efb53..56a063b 100644
--- a/ops/op2/test_cases/async/async_arg_return.out
+++ b/ops/op2/test_cases/async/async_arg_return.out
@@ -44,7 +44,7 @@ impl op_async {
                         deno_core::v8::NewStringType::Normal,
                     )
                     .unwrap();
-                let exc = deno_core::v8::Exception::error(&mut scope, msg);
+                let exc = deno_core::v8::Exception::type_error(&mut scope, msg);
                 scope.throw_exception(exc);
                 return;
             };
diff --git a/ops/op2/test_cases/async/async_arg_return_result.out b/ops/op2/test_cases/async/async_arg_return_result.out
index dcdfc32..2bfe2a2 100644
--- a/ops/op2/test_cases/async/async_arg_return_result.out
+++ b/ops/op2/test_cases/async/async_arg_return_result.out
@@ -44,7 +44,7 @@ impl op_async {
                         deno_core::v8::NewStringType::Normal,
                     )
                     .unwrap();
-                let exc = deno_core::v8::Exception::error(&mut scope, msg);
+                let exc = deno_core::v8::Exception::type_error(&mut scope, msg);
                 scope.throw_exception(exc);
                 return;
             };
diff --git a/ops/op2/test_cases/async/async_result_impl.out b/ops/op2/test_cases/async/async_result_impl.out
index 7e7fcee..7021f0f 100644
--- a/ops/op2/test_cases/async/async_result_impl.out
+++ b/ops/op2/test_cases/async/async_result_impl.out
@@ -44,7 +44,7 @@ impl op_async_result_impl {
                         deno_core::v8::NewStringType::Normal,
                     )
                     .unwrap();
-                let exc = deno_core::v8::Exception::error(&mut scope, msg);
+                let exc = deno_core::v8::Exception::type_error(&mut scope, msg);
                 scope.throw_exception(exc);
                 return;
             };
diff --git a/ops/op2/test_cases/async/async_v8_global.out b/ops/op2/test_cases/async/async_v8_global.out
index 4b783de..f694015 100644
--- a/ops/op2/test_cases/async/async_v8_global.out
+++ b/ops/op2/test_cases/async/async_v8_global.out
@@ -46,7 +46,7 @@ impl op_async_v8_global {
                         deno_core::v8::NewStringType::Normal,
                     )
                     .unwrap();
-                let exc = deno_core::v8::Exception::error(&mut scope, msg);
+                let exc = deno_core::v8::Exception::type_error(&mut scope, msg);
                 scope.throw_exception(exc);
                 return;
             };
diff --git a/ops/op2/test_cases/sync/add.out b/ops/op2/test_cases/sync/add.out
index 186fa58..d853684 100644
--- a/ops/op2/test_cases/sync/add.out
+++ b/ops/op2/test_cases/sync/add.out
@@ -59,7 +59,7 @@ impl op_add {
                         deno_core::v8::NewStringType::Normal,
                     )
                     .unwrap();
-                let exc = deno_core::v8::Exception::error(&mut scope, msg);
+                let exc = deno_core::v8::Exception::type_error(&mut scope, msg);
                 scope.throw_exception(exc);
                 return;
             };
@@ -73,7 +73,7 @@ impl op_add {
                         deno_core::v8::NewStringType::Normal,
                     )
                     .unwrap();
-                let exc = deno_core::v8::Exception::error(&mut scope, msg);
+                let exc = deno_core::v8::Exception::type_error(&mut scope, msg);
                 scope.throw_exception(exc);
                 return;
             };
diff --git a/ops/op2/test_cases/sync/add_options.out b/ops/op2/test_cases/sync/add_options.out
index 72647da..86c4d5e 100644
--- a/ops/op2/test_cases/sync/add_options.out
+++ b/ops/op2/test_cases/sync/add_options.out
@@ -39,7 +39,7 @@ impl op_test_add_option {
                         deno_core::v8::NewStringType::Normal,
                     )
                     .unwrap();
-                let exc = deno_core::v8::Exception::error(&mut scope, msg);
+                let exc = deno_core::v8::Exception::type_error(&mut scope, msg);
                 scope.throw_exception(exc);
                 return;
             };
@@ -56,7 +56,7 @@ impl op_test_add_option {
                             deno_core::v8::NewStringType::Normal,
                         )
                         .unwrap();
-                    let exc = deno_core::v8::Exception::error(&mut scope, msg);
+                    let exc = deno_core::v8::Exception::type_error(&mut scope, msg);
                     scope.throw_exception(exc);
                     return;
                 };
diff --git a/ops/op2/test_cases/sync/nofast.out b/ops/op2/test_cases/sync/nofast.out
index 5a7a554..630e8ec 100644
--- a/ops/op2/test_cases/sync/nofast.out
+++ b/ops/op2/test_cases/sync/nofast.out
@@ -39,7 +39,7 @@ impl op_nofast {
                         deno_core::v8::NewStringType::Normal,
                     )
                     .unwrap();
-                let exc = deno_core::v8::Exception::error(&mut scope, msg);
+                let exc = deno_core::v8::Exception::type_error(&mut scope, msg);
                 scope.throw_exception(exc);
                 return;
             };
@@ -53,7 +53,7 @@ impl op_nofast {
                         deno_core::v8::NewStringType::Normal,
                     )
                     .unwrap();
-                let exc = deno_core::v8::Exception::error(&mut scope, msg);
+                let exc = deno_core::v8::Exception::type_error(&mut scope, msg);
                 scope.throw_exception(exc);
                 return;
             };
diff --git a/ops/op2/test_cases/sync/smi.out b/ops/op2/test_cases/sync/smi.out
index 0b6d0d8..c0681e7 100644
--- a/ops/op2/test_cases/sync/smi.out
+++ b/ops/op2/test_cases/sync/smi.out
@@ -59,7 +59,7 @@ impl op_add {
                         deno_core::v8::NewStringType::Normal,
                     )
                     .unwrap();
-                let exc = deno_core::v8::Exception::error(&mut scope, msg);
+                let exc = deno_core::v8::Exception::type_error(&mut scope, msg);
                 scope.throw_exception(exc);
                 return;
             };
@@ -73,7 +73,7 @@ impl op_add {
                         deno_core::v8::NewStringType::Normal,
                     )
                     .unwrap();
-                let exc = deno_core::v8::Exception::error(&mut scope, msg);
+                let exc = deno_core::v8::Exception::type_error(&mut scope, msg);
                 scope.throw_exception(exc);
                 return;
             };
diff --git a/ops/op2/test_cases/sync/v8_global.out b/ops/op2/test_cases/sync/v8_global.out
index 7f0c247..b1331a6 100644
--- a/ops/op2/test_cases/sync/v8_global.out
+++ b/ops/op2/test_cases/sync/v8_global.out
@@ -46,7 +46,7 @@ impl op_global {
                         deno_core::v8::NewStringType::Normal,
                     )
                     .unwrap();
-                let exc = deno_core::v8::Exception::error(&mut scope, msg);
+                let exc = deno_core::v8::Exception::type_error(&mut scope, msg);
                 scope.throw_exception(exc);
                 return;
             };
diff --git a/ops/op2/test_cases/sync/v8_handlescope.out b/ops/op2/test_cases/sync/v8_handlescope.out
index a26aa60..5801d34 100644
--- a/ops/op2/test_cases/sync/v8_handlescope.out
+++ b/ops/op2/test_cases/sync/v8_handlescope.out
@@ -41,7 +41,7 @@ impl op_handlescope {
                         deno_core::v8::NewStringType::Normal,
                     )
                     .unwrap();
-                let exc = deno_core::v8::Exception::error(&mut scope, msg);
+                let exc = deno_core::v8::Exception::type_error(&mut scope, msg);
                 scope.throw_exception(exc);
                 return;
             };
diff --git a/ops/op2/test_cases/sync/v8_lifetime.out b/ops/op2/test_cases/sync/v8_lifetime.out
index e9002d1..d508606 100644
--- a/ops/op2/test_cases/sync/v8_lifetime.out
+++ b/ops/op2/test_cases/sync/v8_lifetime.out
@@ -41,7 +41,7 @@ impl op_v8_lifetime {
                         deno_core::v8::NewStringType::Normal,
                     )
                     .unwrap();
-                let exc = deno_core::v8::Exception::error(&mut scope, msg);
+                let exc = deno_core::v8::Exception::type_error(&mut scope, msg);
                 scope.throw_exception(exc);
                 return;
             };
diff --git a/ops/op2/test_cases/sync/v8_ref_option.out b/ops/op2/test_cases/sync/v8_ref_option.out
index 7649c9e..22e6e79 100644
--- a/ops/op2/test_cases/sync/v8_ref_option.out
+++ b/ops/op2/test_cases/sync/v8_ref_option.out
@@ -81,7 +81,7 @@ impl op_v8_lifetime {
                         deno_core::v8::NewStringType::Normal,
                     )
                     .unwrap();
-                let exc = deno_core::v8::Exception::error(&mut scope, msg);
+                let exc = deno_core::v8::Exception::type_error(&mut scope, msg);
                 scope.throw_exception(exc);
                 return;
             };
@@ -100,7 +100,7 @@ impl op_v8_lifetime {
                         deno_core::v8::NewStringType::Normal,
                     )
                     .unwrap();
-                let exc = deno_core::v8::Exception::error(&mut scope, msg);
+                let exc = deno_core::v8::Exception::type_error(&mut scope, msg);
                 scope.throw_exception(exc);
                 return;
             };
diff --git a/ops/op2/test_cases/sync/v8_string.out b/ops/op2/test_cases/sync/v8_string.out
index 9f4d927..99273fa 100644
--- a/ops/op2/test_cases/sync/v8_string.out
+++ b/ops/op2/test_cases/sync/v8_string.out
@@ -41,7 +41,7 @@ impl op_v8_string {
                         deno_core::v8::NewStringType::Normal,
                     )
                     .unwrap();
-                let exc = deno_core::v8::Exception::error(&mut scope, msg);
+                let exc = deno_core::v8::Exception::type_error(&mut scope, msg);
                 scope.throw_exception(exc);
                 return;
             };
@@ -57,7 +57,7 @@ impl op_v8_string {
                         deno_core::v8::NewStringType::Normal,
                     )
                     .unwrap();
-                let exc = deno_core::v8::Exception::error(&mut scope, msg);
+                let exc = deno_core::v8::Exception::type_error(&mut scope, msg);
                 scope.throw_exception(exc);
                 return;
             };