feat: 补全 Error 栈访问器 isError toJSON 与 Promise.try

This commit is contained in:
2026-09-22 09:02:30 +00:00
parent 96f3c0cf85
commit cc0ed44bd8
9 changed files with 347 additions and 44 deletions
+2 -1
View File
@@ -158,6 +158,7 @@ impl BuiltinWorld {
("URIError", methods.uri_error, 1),
("EvalError", methods.eval_error, 1),
("SuppressedError", methods.suppressed_error, 3),
("isError", methods.is_error, 1),
);
let proto_ptr = P::as_ptr(&self.error_proto) as *mut JsObject;
@@ -168,7 +169,7 @@ impl BuiltinWorld {
string_forge,
shape_forge,
("toString", methods.to_string, 0),
("stack", methods.stack, 0),
("toJSON", methods.to_json, 1),
);
let si_name = string_forge.intern("name").0;
+2 -1
View File
@@ -83,7 +83,8 @@ pub struct ErrorMethods {
pub eval_error: *const (),
pub suppressed_error: *const (),
pub to_string: *const (),
pub stack: *const (),
pub is_error: *const (),
pub to_json: *const (),
}
/// String 静态方法与原型方法的 native 函数指针集合,由 [crate::builtin::BuiltinWorld::bind_string_methods] 安装。