refactor: 统一错误对象构造与异常类型传播

This commit is contained in:
爱特每羊队
2026-06-23 14:51:58 +08:00
parent 51ebcbdb9b
commit 1ed6562063
11 changed files with 71 additions and 77 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ impl Vm {
&mut self, callee: JsValue, callee_obj: &JsObject, receiver: JsValue, args: &[JsValue],
) -> Result<JsValue, String> {
if callee_obj.sub_module_index() == 0 {
return Err("TypeError: accessor is not callable".into());
return Err(self.error_message_text("TypeError", "accessor is not callable"));
}
let sub_idx = callee_obj.sub_module_index() as usize - 1;
if sub_idx >= self.sub_modules.len() {