Skip to content

Commit c188660

Browse files
theanarkhruyadorno
authored andcommitted
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

Lines changed: 10 additions & 0 deletions
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

Lines changed: 9 additions & 0 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy