Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: fix check fd #56000

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
9 changes: 9 additions & 0 deletions test/parallel/test-fs-stat.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
);
}
Loading