| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c52bc5d commit c188660
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -760,6 +760,16 @@ std::string DetermineSpecificErrorType(Environment* env, | |||
| 760 | 760 | input.As<v8::Object>()->GetConstructorName(); | |
| 761 | 761 | Utf8Value name(env->isolate(), constructor_name); | |
| 762 | 762 | 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(); | ||
| 763 | 773 | } | |
| 764 | 774 | ||
| 765 | 775 | Utf8Value utf8_value(env->isolate(), | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -212,3 +212,12 @@ fs.lstat(__filename, undefined, common.mustCall()); | |||
| 212 | 212 | assert.strictEqual(s.birthtime, 5); | |
| 213 | 213 | })); | |
| 214 | 214 | } | |
| 215 | + | ||
| 216 | + { | ||
| 217 | + assert.throws( | ||
| 218 | + () => fs.fstat(Symbol('test'), () => {}), | ||
| 219 | + { | ||
| 220 | + code: 'ERR_INVALID_ARG_TYPE', | ||
| 221 | + }, | ||
| 222 | + ); | ||
| 223 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments