Welcome! Log In Create A New Profile

Advanced

[njs] Improved text for method frame exception.

Dmitry Volyntsev
April 25, 2019 12:52PM
details: https://hg.nginx.org/njs/rev/65d6076eb349
branches:
changeset: 929:65d6076eb349
user: Dmitry Volyntsev <xeioex@nginx.com>
date: Thu Apr 25 19:33:35 2019 +0300
description:
Improved text for method frame exception.

diffstat:

njs/njs_vm.c | 3 ++-
njs/test/njs_expect_test.exp | 2 +-
njs/test/njs_unit_test.c | 9 ++++++---
3 files changed, 9 insertions(+), 5 deletions(-)

diffs (60 lines):

diff -r 9ca942bc0792 -r 65d6076eb349 njs/njs_vm.c
--- a/njs/njs_vm.c Thu Apr 25 15:56:44 2019 +0300
+++ b/njs/njs_vm.c Thu Apr 25 19:33:35 2019 +0300
@@ -1997,7 +1997,8 @@ njs_vmcode_method_frame(njs_vm_t *vm, nj

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 -r 9ca942bc0792 -r 65d6076eb349 njs/test/njs_expect_test.exp
--- a/njs/test/njs_expect_test.exp Thu Apr 25 15:56:44 2019 +0300
+++ b/njs/test/njs_expect_test.exp Thu Apr 25 19:33:35 2019 +0300
@@ -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 -r 9ca942bc0792 -r 65d6076eb349 njs/test/njs_unit_test.c
--- a/njs/test/njs_unit_test.c Thu Apr 25 15:56:44 2019 +0300
+++ b/njs/test/njs_unit_test.c Thu Apr 25 19:33:35 2019 +0300
@@ -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") },
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[njs] Improved text for method frame exception.

Dmitry Volyntsev 317 April 25, 2019 12:52PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 313
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready