[njs] Returning an internal error for not-implemented Function().

Dmitry Volyntsev xeioex at nginx.com
Wed Aug 1 15:37:32 UTC 2018


details:   http://hg.nginx.org/njs/rev/4586ae051111
branches:  
changeset: 581:4586ae051111
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Wed Aug 01 18:37:15 2018 +0300
description:
Returning an internal error for not-implemented Function().

This fixes #41 issue on GitHub.

diffstat:

 njs/njs_function.c       |  2 ++
 njs/test/njs_unit_test.c |  3 +++
 2 files changed, 5 insertions(+), 0 deletions(-)

diffs (25 lines):

diff -r 72aa4d9aa606 -r 4586ae051111 njs/njs_function.c
--- a/njs/njs_function.c	Wed Aug 01 18:05:01 2018 +0300
+++ b/njs/njs_function.c	Wed Aug 01 18:37:15 2018 +0300
@@ -457,6 +457,8 @@ njs_ret_t
 njs_function_constructor(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,
     njs_index_t unused)
 {
+    njs_internal_error(vm, "Not implemented");
+
     return NXT_ERROR;
 }
 
diff -r 72aa4d9aa606 -r 4586ae051111 njs/test/njs_unit_test.c
--- a/njs/test/njs_unit_test.c	Wed Aug 01 18:05:01 2018 +0300
+++ b/njs/test/njs_unit_test.c	Wed Aug 01 18:37:15 2018 +0300
@@ -6518,6 +6518,9 @@ static njs_unit_test_t  njs_test[] =
     { nxt_string("function f() {} f.__proto__ === Function.prototype"),
       nxt_string("true") },
 
+    { nxt_string("Function()"),
+      nxt_string("InternalError: Not implemented") },
+
     { nxt_string("RegExp()"),
       nxt_string("/(?:)/") },
 


More information about the nginx-devel mailing list