summaryrefslogtreecommitdiff
path: root/src/js_native_api_v8.cc
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2019-03-18 15:43:11 +0100
committerRuben Bridgewater <ruben@bridgewater.de>2019-03-23 02:55:57 +0100
commitf0f26cedccdb8e5d891bff2949651ea8c3a839c1 (patch)
tree8a05b335b407f283a8df1d8069d6b1d81266c090 /src/js_native_api_v8.cc
parente96e3f9eb0610168b0b06977664c0e713571b066 (diff)
downloadandroid-node-v8-f0f26cedccdb8e5d891bff2949651ea8c3a839c1.tar.gz
android-node-v8-f0f26cedccdb8e5d891bff2949651ea8c3a839c1.tar.bz2
android-node-v8-f0f26cedccdb8e5d891bff2949651ea8c3a839c1.zip
n-api: remove code from error name
This is a first step to align the n-api errors towards errors created in JS. The stack still has to be updated to add the error code. PR-URL: https://github.com/nodejs/node/pull/26738 Fixes: https://github.com/nodejs/node/issues/26669 Fixes: https://github.com/nodejs/node/issues/20253 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'src/js_native_api_v8.cc')
-rw-r--r--src/js_native_api_v8.cc27
1 files changed, 0 insertions, 27 deletions
diff --git a/src/js_native_api_v8.cc b/src/js_native_api_v8.cc
index 97600a9fb1..f7c6b6db4f 100644
--- a/src/js_native_api_v8.cc
+++ b/src/js_native_api_v8.cc
@@ -1532,33 +1532,6 @@ static inline napi_status set_error_code(napi_env env,
RETURN_STATUS_IF_FALSE(env,
set_maybe.FromMaybe(false),
napi_generic_failure);
-
- // now update the name to be "name [code]" where name is the
- // original name and code is the code associated with the Error
- v8::Local<v8::String> name_string;
- CHECK_NEW_FROM_UTF8(env, name_string, "");
- v8::Local<v8::Name> name_key;
- CHECK_NEW_FROM_UTF8(env, name_key, "name");
-
- auto maybe_name = err_object->Get(context, name_key);
- if (!maybe_name.IsEmpty()) {
- v8::Local<v8::Value> name = maybe_name.ToLocalChecked();
- if (name->IsString()) {
- name_string =
- v8::String::Concat(isolate, name_string, name.As<v8::String>());
- }
- }
- name_string = v8::String::Concat(
- isolate, name_string, NAPI_FIXED_ONE_BYTE_STRING(isolate, " ["));
- name_string =
- v8::String::Concat(isolate, name_string, code_value.As<v8::String>());
- name_string = v8::String::Concat(
- isolate, name_string, NAPI_FIXED_ONE_BYTE_STRING(isolate, "]"));
-
- set_maybe = err_object->Set(context, name_key, name_string);
- RETURN_STATUS_IF_FALSE(env,
- set_maybe.FromMaybe(false),
- napi_generic_failure);
}
return napi_ok;
}