From: Dmitry Volyntsev Date: Thu, 25 Apr 2019 16:33:35 +0000 (+0300) Subject: Improved text for method frame exception. X-Git-Tag: 0.3.2~44 X-Git-Url: http://www.kaiwu.me/postgresql/commit/?a=commitdiff_plain;h=432d8656a41a838e018f649bbe26d20a9d59fed3;p=njs.git Improved text for method frame exception. --- diff --git a/njs/njs_vm.c b/njs/njs_vm.c index 53669854..5d2728c5 100644 --- a/njs/njs_vm.c +++ b/njs/njs_vm.c @@ -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; } diff --git a/njs/test/njs_expect_test.exp b/njs/test/njs_expect_test.exp index a194735d..c1d9ad22 100644 --- a/njs/test/njs_expect_test.exp +++ b/njs/test/njs_expect_test.exp @@ -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 { diff --git a/njs/test/njs_unit_test.c b/njs/test/njs_unit_test.c index 6f4c90a4..6cfe0018 100644 --- a/njs/test/njs_unit_test.c +++ b/njs/test/njs_unit_test.c @@ -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") },