summaryrefslogtreecommitdiff
path: root/src/node_util.cc
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2017-10-26 21:34:15 -0700
committerJames M Snell <jasnell@gmail.com>2017-11-02 07:24:49 -0700
commit3d20190a3a83ee8144b47a55a9a18b56b25f9be0 (patch)
tree2f3d1f9cea26a76ae9cab076589052fddd2a87d8 /src/node_util.cc
parent841e305e4c0bc9f633006a293b893fd69dbbf596 (diff)
downloadnode-new-3d20190a3a83ee8144b47a55a9a18b56b25f9be0.tar.gz
src: remove throws in set/getHiddenValue
These are internal only utility functions, CHECK instead of throw PR-URL: https://github.com/nodejs/node/pull/16544 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'src/node_util.cc')
-rw-r--r--src/node_util.cc14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/node_util.cc b/src/node_util.cc
index fa30ae4472..6683eee07a 100644
--- a/src/node_util.cc
+++ b/src/node_util.cc
@@ -101,11 +101,8 @@ inline Local<Private> IndexToPrivateSymbol(Environment* env, uint32_t index) {
static void GetHiddenValue(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
- if (!args[0]->IsObject())
- return env->ThrowTypeError("obj must be an object");
-
- if (!args[1]->IsUint32())
- return env->ThrowTypeError("index must be an uint32");
+ CHECK(args[0]->IsObject());
+ CHECK(args[1]->IsUint32());
Local<Object> obj = args[0].As<Object>();
auto index = args[1]->Uint32Value(env->context()).FromJust();
@@ -118,11 +115,8 @@ static void GetHiddenValue(const FunctionCallbackInfo<Value>& args) {
static void SetHiddenValue(const FunctionCallbackInfo<Value>& args) {
Environment* env = Environment::GetCurrent(args);
- if (!args[0]->IsObject())
- return env->ThrowTypeError("obj must be an object");
-
- if (!args[1]->IsUint32())
- return env->ThrowTypeError("index must be an uint32");
+ CHECK(args[0]->IsObject());
+ CHECK(args[1]->IsUint32());
Local<Object> obj = args[0].As<Object>();
auto index = args[1]->Uint32Value(env->context()).FromJust();