Skip to content

Commit c188660

Browse files
theanarkhruyadorno
authored andcommittedJan 5, 2025
src: fix check fd
PR-URL: #56000 Fixes: #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>
1 parent c52bc5d commit c188660

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed
 

‎src/util.cc

+10
Original file line numberDiff line numberDiff line change
@@ -760,6 +760,16 @@ std::string DetermineSpecificErrorType(Environment* env,
760760
input.As<v8::Object>()->GetConstructorName();
761761
Utf8Value name(env->isolate(), constructor_name);
762762
return SPrintF("an instance of %s", name.out());
763+
} else if (input->IsSymbol()) {
764+
v8::MaybeLocal<v8::String> str =
765+
input.As<v8::Symbol>()->ToDetailString(env->context());
766+
v8::Local<v8::String> js_str;
767+
if (!str.ToLocal(&js_str)) {
768+
return "Symbol";
769+
}
770+
Utf8Value name(env->isolate(), js_str);
771+
// Symbol(xxx)
772+
return name.out();
763773
}
764774

765775
Utf8Value utf8_value(env->isolate(),

‎test/parallel/test-fs-stat.js

+9
Original file line numberDiff line numberDiff line change
@@ -212,3 +212,12 @@ fs.lstat(__filename, undefined, common.mustCall());
212212
assert.strictEqual(s.birthtime, 5);
213213
}));
214214
}
215+
216+
{
217+
assert.throws(
218+
() => fs.fstat(Symbol('test'), () => {}),
219+
{
220+
code: 'ERR_INVALID_ARG_TYPE',
221+
},
222+
);
223+
}

0 commit comments

Comments
 (0)
Please sign in to comment.