mirror of
https://github.com/nodejs/node.git
synced 2026-10-28 18:25:13 +08:00
src: fix check fd
PR-URL: https://github.com/nodejs/node/pull/56000 Fixes: https://github.com/nodejs/node/issues/55983 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Jason Zhang <xzha4350@gmail.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
This commit is contained in:
1 parent
d09458f3f0
commit
aa7c8ccd45
2 files changed
+19
No files matched your search
+10
@@ -782,6 +782,16 @@ std::string DetermineSpecificErrorType(Environment* env,
|
||||
input.As<v8::Object>()->GetConstructorName();
|
||||
Utf8Value name(env->isolate(), constructor_name);
|
||||
return SPrintF("an instance of %s", name.out());
|
||||
} else if (input->IsSymbol()) {
|
||||
v8::MaybeLocal<v8::String> str =
|
||||
input.As<v8::Symbol>()->ToDetailString(env->context());
|
||||
v8::Local<v8::String> js_str;
|
||||
if (!str.ToLocal(&js_str)) {
|
||||
return "Symbol";
|
||||
}
|
||||
Utf8Value name(env->isolate(), js_str);
|
||||
// Symbol(xxx)
|
||||
return name.out();
|
||||
}
|
||||
|
||||
Utf8Value utf8_value(env->isolate(),
|
||||
|
||||
@@ -212,3 +212,12 @@ fs.lstat(__filename, undefined, common.mustCall());
|
||||
assert.strictEqual(s.birthtime, 5);
|
||||
}));
|
||||
}
|
||||
|
||||
{
|
||||
assert.throws(
|
||||
() => fs.fstat(Symbol('test'), () => {}),
|
||||
{
|
||||
code: 'ERR_INVALID_ARG_TYPE',
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user