]> git.kaiwu.me - njs.git/commitdiff
Improved text for method frame exception.
authorDmitry Volyntsev <xeioex@nginx.com>
Thu, 25 Apr 2019 16:33:35 +0000 (19:33 +0300)
committerDmitry Volyntsev <xeioex@nginx.com>
Thu, 25 Apr 2019 16:33:35 +0000 (19:33 +0300)
njs/njs_vm.c
njs/test/njs_expect_test.exp
njs/test/njs_unit_test.c

index 536698546a1877442e9a77fc4db909ed8e23fb20..5d2728c561a2554296d19ba4c4c7177fa2f7f968 100644 (file)
@@ -1997,7 +1997,8 @@ njs_vmcode_method_frame(njs_vm_t *vm, njs_value_t *object, njs_value_t *name)
 
     if (value == NULL || !njs_is_function(value)) {
         njs_string_get(name, &string);
-        njs_type_error(vm, "\"%V\" is not a function", &string);
+        njs_type_error(vm, "(intermediate value)[\"%V\"] is not a function",
+                       &string);
         return NXT_ERROR;
     }
 
index a194735da092962bf4e310f31178277a9cd43f16..c1d9ad22effc710920e5c655907f9a874c0e6a79 100644 (file)
@@ -224,7 +224,7 @@ njs_test {
 
 njs_test {
     {"console.ll()\r\n"
-     "console.ll()\r\nTypeError: \"ll\" is not a function"}
+     "console.ll()\r\nTypeError: (intermediate value)\\\[\"ll\"] is not a function"}
 }
 
 njs_test {
index 6f4c90a46c47cdf3dd68d3195635a90851c90bc3..6cfe0018d93234145e2c026e645bcc31a21d0754 100644 (file)
@@ -1645,6 +1645,9 @@ static njs_unit_test_t  njs_test[] =
     { nxt_string("'-1' < {valueOf: function() {return -2}}"),
       nxt_string("false") },
 
+    { nxt_string("new 0[isNaN]"),
+      nxt_string("TypeError: (intermediate value)[\"[object Function]\"] is not a function") },
+
     /**/
 
     { nxt_string("var a; a = 1 ? 2 : 3"),
@@ -5990,7 +5993,7 @@ static njs_unit_test_t  njs_test[] =
       nxt_string("TypeError: number is not a function") },
 
     { nxt_string("var o = {a:1}; o.a()"),
-      nxt_string("TypeError: \"a\" is not a function") },
+      nxt_string("TypeError: (intermediate value)[\"a\"] is not a function") },
 
     { nxt_string("(function(){})()"),
       nxt_string("undefined") },
@@ -7444,10 +7447,10 @@ static njs_unit_test_t  njs_test[] =
       nxt_string("SyntaxError: Unexpected token \"null\" in 1") },
 
     { nxt_string("'a'.f()"),
-      nxt_string("TypeError: \"f\" is not a function") },
+      nxt_string("TypeError: (intermediate value)[\"f\"] is not a function") },
 
     { nxt_string("1..f()"),
-      nxt_string("TypeError: \"f\" is not a function") },
+      nxt_string("TypeError: (intermediate value)[\"f\"] is not a function") },
 
     { nxt_string("try {}"),
       nxt_string("SyntaxError: Missing catch or finally after try in 1") },