[njs] Short exception macros' names.

Dmitry Volyntsev xeioex at nginx.com
Tue Mar 27 16:12:47 UTC 2018


details:   http://hg.nginx.org/njs/rev/ecf693afd698
branches:  
changeset: 471:ecf693afd698
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Tue Mar 27 19:11:04 2018 +0300
description:
Short exception macros' names.

diffstat:

 njs/njs_array.c             |   8 ++--
 njs/njs_boolean.c           |   8 ++--
 njs/njs_builtin.c           |   6 +-
 njs/njs_date.c              |   4 +-
 njs/njs_error.c             |  28 +++++++-------
 njs/njs_error.h             |  24 ++++++------
 njs/njs_event.c             |   4 +-
 njs/njs_fs.c                |  88 ++++++++++++++++++++++----------------------
 njs/njs_function.c          |  14 +++----
 njs/njs_generator.c         |   4 +-
 njs/njs_json.c              |  45 +++++++++++-----------
 njs/njs_module.c            |   6 +-
 njs/njs_number.c            |  10 ++--
 njs/njs_object.c            |  39 ++++++++-----------
 njs/njs_parser.c            |  13 +++---
 njs/njs_parser_expression.c |  14 ++++---
 njs/njs_regexp.c            |  15 +++----
 njs/njs_string.c            |  23 +++++------
 njs/njs_time.c              |  11 ++---
 njs/njs_variable.c          |   3 +-
 njs/njs_vm.c                |  41 +++++++++-----------
 21 files changed, 196 insertions(+), 212 deletions(-)

diffs (truncated from 1446 to 1000 lines):

diff -r 9dfa2e1892d0 -r ecf693afd698 njs/njs_array.c
--- a/njs/njs_array.c	Fri Mar 23 14:03:09 2018 +0300
+++ b/njs/njs_array.c	Tue Mar 27 19:11:04 2018 +0300
@@ -249,7 +249,7 @@ njs_array_constructor(njs_vm_t *vm, njs_
         size = (uint32_t) num;
 
         if ((double) size != num) {
-            njs_exception_range_error(vm, NULL, NULL);
+            njs_range_error(vm, NULL, NULL);
             return NXT_ERROR;
         }
 
@@ -1715,7 +1715,7 @@ njs_array_prototype_reduce(njs_vm_t *vm,
         n = njs_array_iterator_index(array, iter);
 
         if (n == NJS_ARRAY_INVALID_INDEX) {
-            njs_exception_type_error(vm, "invalid index", NULL);
+            njs_type_error(vm, "invalid index", NULL);
             return NXT_ERROR;
         }
 
@@ -1776,7 +1776,7 @@ njs_array_iterator_args(njs_vm_t *vm, nj
         return NXT_OK;
     }
 
-    njs_exception_type_error(vm, "unexpected iterator arguments", NULL);
+    njs_type_error(vm, "unexpected iterator arguments", NULL);
 
     return NXT_ERROR;
 }
@@ -1850,7 +1850,7 @@ njs_array_prototype_reduce_right(njs_vm_
         n = njs_array_reduce_right_index(array, iter);
 
         if (n == NJS_ARRAY_INVALID_INDEX) {
-            njs_exception_type_error(vm, "invalid index", NULL);
+            njs_type_error(vm, "invalid index", NULL);
 
             return NXT_ERROR;
         }
diff -r 9dfa2e1892d0 -r ecf693afd698 njs/njs_boolean.c
--- a/njs/njs_boolean.c	Fri Mar 23 14:03:09 2018 +0300
+++ b/njs/njs_boolean.c	Tue Mar 27 19:11:04 2018 +0300
@@ -99,8 +99,8 @@ njs_boolean_prototype_value_of(njs_vm_t 
             value = &value->data.u.object_value->value;
 
         } else {
-            njs_exception_type_error(vm, "unexpected value type:%s",
-                                     njs_type_string(value->type));
+            njs_type_error(vm, "unexpected value type:%s",
+                           njs_type_string(value->type));
             return NXT_ERROR;
         }
     }
@@ -125,8 +125,8 @@ njs_boolean_prototype_to_string(njs_vm_t
             value = &value->data.u.object_value->value;
 
         } else {
-            njs_exception_type_error(vm, "unexpected value type:%s",
-                                     njs_type_string(value->type));
+            njs_type_error(vm, "unexpected value type:%s",
+                           njs_type_string(value->type));
             return NXT_ERROR;
         }
     }
diff -r 9dfa2e1892d0 -r ecf693afd698 njs/njs_builtin.c
--- a/njs/njs_builtin.c	Fri Mar 23 14:03:09 2018 +0300
+++ b/njs/njs_builtin.c	Tue Mar 27 19:11:04 2018 +0300
@@ -75,7 +75,7 @@ const njs_object_init_t  *njs_prototype_
     &njs_eval_error_prototype_init,
     &njs_internal_error_prototype_init,
     &njs_range_error_prototype_init,
-    &njs_ref_error_prototype_init,
+    &njs_reference_error_prototype_init,
     &njs_syntax_error_prototype_init,
     &njs_type_error_prototype_init,
     &njs_uri_error_prototype_init,
@@ -95,7 +95,7 @@ const njs_object_init_t    *njs_construc
     &njs_eval_error_constructor_init,
     &njs_internal_error_constructor_init,
     &njs_range_error_constructor_init,
-    &njs_ref_error_constructor_init,
+    &njs_reference_error_constructor_init,
     &njs_syntax_error_constructor_init,
     &njs_type_error_constructor_init,
     &njs_uri_error_constructor_init,
@@ -220,7 +220,7 @@ njs_builtin_objects_create(njs_vm_t *vm)
           { NJS_SKIP_ARG, NJS_STRING_ARG } },
         { njs_range_error_constructor,
           { NJS_SKIP_ARG, NJS_STRING_ARG } },
-        { njs_ref_error_constructor,  { NJS_SKIP_ARG, NJS_STRING_ARG } },
+        { njs_reference_error_constructor,  { NJS_SKIP_ARG, NJS_STRING_ARG } },
         { njs_syntax_error_constructor,
           { NJS_SKIP_ARG, NJS_STRING_ARG } },
         { njs_type_error_constructor, { NJS_SKIP_ARG, NJS_STRING_ARG } },
diff -r 9dfa2e1892d0 -r ecf693afd698 njs/njs_date.c
--- a/njs/njs_date.c	Fri Mar 23 14:03:09 2018 +0300
+++ b/njs/njs_date.c	Tue Mar 27 19:11:04 2018 +0300
@@ -1063,7 +1063,7 @@ njs_date_prototype_to_iso_string(njs_vm_
         return njs_string_new(vm, &vm->retval, buf, size, size);
     }
 
-    njs_exception_range_error(vm, NULL, NULL);
+    njs_range_error(vm, NULL, NULL);
 
     return NXT_ERROR;
 }
@@ -1911,7 +1911,7 @@ njs_date_prototype_to_json(njs_vm_t *vm,
         }
     }
 
-    njs_exception_type_error(vm, "'this' argument is not an object", NULL);
+    njs_type_error(vm, "'this' argument is not an object", NULL);
 
     return NXT_ERROR;
 }
diff -r 9dfa2e1892d0 -r ecf693afd698 njs/njs_error.c
--- a/njs/njs_error.c	Fri Mar 23 14:03:09 2018 +0300
+++ b/njs/njs_error.c	Tue Mar 27 19:11:04 2018 +0300
@@ -68,7 +68,7 @@ njs_exception_error_create(njs_vm_t *vm,
 
 memory_error:
 
-    njs_exception_memory_error(vm);
+    njs_memory_error(vm);
 }
 
 
@@ -154,7 +154,7 @@ njs_error_create(njs_vm_t *vm, njs_value
 
     error = njs_error_alloc(vm, type, NULL, value);
     if (nxt_slow_path(error == NULL)) {
-        njs_exception_memory_error(vm);
+        njs_memory_error(vm);
         return NXT_ERROR;
     }
 
@@ -327,14 +327,14 @@ const njs_object_init_t  njs_range_error
 
 
 njs_ret_t
-njs_ref_error_constructor(njs_vm_t *vm, njs_value_t *args,
+njs_reference_error_constructor(njs_vm_t *vm, njs_value_t *args,
     nxt_uint_t nargs, njs_index_t unused)
 {
     return njs_error_create(vm, args, nargs, NJS_OBJECT_REF_ERROR);
 }
 
 
-static const njs_object_prop_t  njs_ref_error_constructor_properties[] =
+static const njs_object_prop_t  njs_reference_error_constructor_properties[] =
 {
     /* ReferenceError.name == "ReferenceError". */
     {
@@ -359,10 +359,10 @@ static const njs_object_prop_t  njs_ref_
 };
 
 
-const njs_object_init_t  njs_ref_error_constructor_init = {
+const njs_object_init_t  njs_reference_error_constructor_init = {
     nxt_string("ReferenceError"),
-    njs_ref_error_constructor_properties,
-    nxt_nitems(njs_ref_error_constructor_properties),
+    njs_reference_error_constructor_properties,
+    nxt_nitems(njs_reference_error_constructor_properties),
 };
 
 
@@ -515,7 +515,7 @@ njs_set_memory_error(njs_vm_t *vm, njs_v
 
 
 void
-njs_exception_memory_error(njs_vm_t *vm)
+njs_memory_error(njs_vm_t *vm)
 {
     njs_set_memory_error(vm, &vm->retval);
 }
@@ -612,7 +612,7 @@ njs_error_prototype_to_string(njs_vm_t *
     static const njs_value_t  default_name = njs_string("Error");
 
     if (nargs < 1 || !njs_is_object(&args[0])) {
-        njs_exception_type_error(vm, "'this' argument is not an object", NULL);
+        njs_type_error(vm, "'this' argument is not an object", NULL);
         return NXT_ERROR;
     }
 
@@ -668,7 +668,7 @@ njs_error_prototype_to_string(njs_vm_t *
         return NJS_OK;
     }
 
-    njs_exception_memory_error(vm);
+    njs_memory_error(vm);
     return NJS_ERROR;
 }
 
@@ -786,7 +786,7 @@ const njs_object_init_t  njs_range_error
 };
 
 
-static const njs_object_prop_t  njs_ref_error_prototype_properties[] =
+static const njs_object_prop_t  njs_reference_error_prototype_properties[] =
 {
     {
         .type = NJS_PROPERTY,
@@ -796,10 +796,10 @@ static const njs_object_prop_t  njs_ref_
 };
 
 
-const njs_object_init_t  njs_ref_error_prototype_init = {
+const njs_object_init_t  njs_reference_error_prototype_init = {
     nxt_string("ReferenceError"),
-    njs_ref_error_prototype_properties,
-    nxt_nitems(njs_ref_error_prototype_properties),
+    njs_reference_error_prototype_properties,
+    nxt_nitems(njs_reference_error_prototype_properties),
 };
 
 
diff -r 9dfa2e1892d0 -r ecf693afd698 njs/njs_error.h
--- a/njs/njs_error.h	Fri Mar 23 14:03:09 2018 +0300
+++ b/njs/njs_error.h	Tue Mar 27 19:11:04 2018 +0300
@@ -8,27 +8,27 @@
 #define _NJS_ERROR_H_INCLUDED_
 
 
-#define njs_exception_error(vm, fmt, ...)                                     \
+#define njs_error(vm, fmt, ...)                                               \
     njs_exception_error_create(vm, NJS_OBJECT_ERROR, fmt, __VA_ARGS__)
-#define njs_exception_eval_error(vm, fmt, ...)                                \
+#define njs_eval_error(vm, fmt, ...)                                          \
     njs_exception_error_create(vm, NJS_OBJECT_EVAL_ERROR, fmt, __VA_ARGS__)
-#define njs_exception_internal_error(vm, fmt, ...)                            \
+#define njs_internal_error(vm, fmt, ...)                                      \
     njs_exception_error_create(vm, NJS_OBJECT_INTERNAL_ERROR, fmt, __VA_ARGS__)
-#define njs_exception_range_error(vm, fmt, ...)                               \
+#define njs_range_error(vm, fmt, ...)                                         \
     njs_exception_error_create(vm, NJS_OBJECT_RANGE_ERROR, fmt, __VA_ARGS__)
-#define njs_exception_ref_error(vm, fmt, ...)                                 \
+#define njs_reference_error(vm, fmt, ...)                                     \
     njs_exception_error_create(vm, NJS_OBJECT_REF_ERROR, fmt, __VA_ARGS__)
-#define njs_exception_syntax_error(vm, fmt, ...)                              \
+#define njs_syntax_error(vm, fmt, ...)                                        \
     njs_exception_error_create(vm, NJS_OBJECT_SYNTAX_ERROR, fmt, __VA_ARGS__)
-#define njs_exception_type_error(vm, fmt, ...)                                \
+#define njs_type_error(vm, fmt, ...)                                          \
     njs_exception_error_create(vm, NJS_OBJECT_TYPE_ERROR, fmt, __VA_ARGS__)
-#define njs_exception_uri_error(vm, fmt, ...)                                 \
+#define njs_uri_error(vm, fmt, ...)                                           \
     njs_exception_error_create(vm, NJS_OBJECT_URI_ERROR, fmt, __VA_ARGS__)
 
 void njs_exception_error_create(njs_vm_t *vm, njs_value_type_t type,
     const char* fmt, ...);
 
-void njs_exception_memory_error(njs_vm_t *vm);
+void njs_memory_error(njs_vm_t *vm);
 void njs_set_memory_error(njs_vm_t *vm, njs_value_t *value);
 
 njs_object_t *njs_error_alloc(njs_vm_t *vm, njs_value_type_t type,
@@ -41,7 +41,7 @@ njs_ret_t njs_internal_error_constructor
     nxt_uint_t nargs, njs_index_t unused);
 njs_ret_t njs_range_error_constructor(njs_vm_t *vm, njs_value_t *args,
     nxt_uint_t nargs, njs_index_t unused);
-njs_ret_t njs_ref_error_constructor(njs_vm_t *vm, njs_value_t *args,
+njs_ret_t njs_reference_error_constructor(njs_vm_t *vm, njs_value_t *args,
     nxt_uint_t nargs, njs_index_t unused);
 njs_ret_t njs_syntax_error_constructor(njs_vm_t *vm, njs_value_t *args,
     nxt_uint_t nargs, njs_index_t unused);
@@ -57,7 +57,7 @@ extern const njs_object_init_t  njs_erro
 extern const njs_object_init_t  njs_eval_error_constructor_init;
 extern const njs_object_init_t  njs_internal_error_constructor_init;
 extern const njs_object_init_t  njs_range_error_constructor_init;
-extern const njs_object_init_t  njs_ref_error_constructor_init;
+extern const njs_object_init_t  njs_reference_error_constructor_init;
 extern const njs_object_init_t  njs_syntax_error_constructor_init;
 extern const njs_object_init_t  njs_type_error_constructor_init;
 extern const njs_object_init_t  njs_uri_error_constructor_init;
@@ -68,7 +68,7 @@ extern const njs_object_init_t  njs_erro
 extern const njs_object_init_t  njs_eval_error_prototype_init;
 extern const njs_object_init_t  njs_internal_error_prototype_init;
 extern const njs_object_init_t  njs_range_error_prototype_init;
-extern const njs_object_init_t  njs_ref_error_prototype_init;
+extern const njs_object_init_t  njs_reference_error_prototype_init;
 extern const njs_object_init_t  njs_syntax_error_prototype_init;
 extern const njs_object_init_t  njs_type_error_prototype_init;
 extern const njs_object_init_t  njs_uri_error_prototype_init;
diff -r 9dfa2e1892d0 -r ecf693afd698 njs/njs_event.c
--- a/njs/njs_event.c	Fri Mar 23 14:03:09 2018 +0300
+++ b/njs/njs_event.c	Tue Mar 27 19:11:04 2018 +0300
@@ -79,8 +79,8 @@ njs_add_event(njs_vm_t *vm, njs_event_t 
 
     ret = nxt_lvlhsh_insert(&vm->events_hash, &lhq);
     if (nxt_slow_path(ret != NXT_OK)) {
-        njs_exception_internal_error(vm, "Failed to add event with id: %s",
-                                     njs_string_short_start(&event->id));
+        njs_internal_error(vm, "Failed to add event with id: %s",
+                           njs_string_short_start(&event->id));
 
         njs_del_event(vm, event, NJS_EVENT_RELEASE | NJS_EVENT_DELETE);
         return NJS_ERROR;
diff -r 9dfa2e1892d0 -r ecf693afd698 njs/njs_fs.c
--- a/njs/njs_fs.c	Fri Mar 23 14:03:09 2018 +0300
+++ b/njs/njs_fs.c	Tue Mar 27 19:11:04 2018 +0300
@@ -116,12 +116,12 @@ njs_fs_read_file(njs_vm_t *vm, njs_value
     nxt_lvlhsh_query_t  lhq;
 
     if (nxt_slow_path(nargs < 3)) {
-        njs_exception_type_error(vm, "too few arguments", NULL);
+        njs_type_error(vm, "too few arguments", NULL);
         return NJS_ERROR;
     }
 
     if (nxt_slow_path(!njs_is_string(&args[1]))) {
-        njs_exception_type_error(vm, "path must be a string", NULL);
+        njs_type_error(vm, "path must be a string", NULL);
         return NJS_ERROR;
     }
 
@@ -155,13 +155,13 @@ njs_fs_read_file(njs_vm_t *vm, njs_value
             }
 
         } else {
-            njs_exception_type_error(vm, "Unknown options type "
-                                     "(a string or object required)", NULL);
+            njs_type_error(vm, "Unknown options type "
+                           "(a string or object required)", NULL);
             return NJS_ERROR;
         }
 
         if (nxt_slow_path(nargs < 4 || !njs_is_function(&args[3]))) {
-            njs_exception_type_error(vm, "callback must be a function", NULL);
+            njs_type_error(vm, "callback must be a function", NULL);
             return NJS_ERROR;
         }
 
@@ -169,7 +169,7 @@ njs_fs_read_file(njs_vm_t *vm, njs_value
 
     } else {
         if (nxt_slow_path(!njs_is_function(&args[2]))) {
-            njs_exception_type_error(vm, "callback must be a function", NULL);
+            njs_type_error(vm, "callback must be a function", NULL);
             return NJS_ERROR;
         }
 
@@ -182,8 +182,8 @@ njs_fs_read_file(njs_vm_t *vm, njs_value
 
     flags = njs_fs_flags(&flag);
     if (nxt_slow_path(flags == -1)) {
-        njs_exception_type_error(vm, "Unknown file open flags: '%.*s'",
-                                 (int) flag.length, flag.start);
+        njs_type_error(vm, "Unknown file open flags: '%.*s'",
+                       (int) flag.length, flag.start);
         return NJS_ERROR;
     }
 
@@ -195,8 +195,8 @@ njs_fs_read_file(njs_vm_t *vm, njs_value
     if (encoding.length != 0
         && (encoding.length != 4 || memcmp(encoding.start, "utf8", 4) != 0))
     {
-        njs_exception_type_error(vm, "Unknown encoding: '%.*s'",
-                                 (int) encoding.length, encoding.start);
+        njs_type_error(vm, "Unknown encoding: '%.*s'",
+                       (int) encoding.length, encoding.start);
         return NJS_ERROR;
     }
 
@@ -309,7 +309,7 @@ memory_error:
         (void) close(fd);
     }
 
-    njs_exception_memory_error(vm);
+    njs_memory_error(vm);
 
     return NJS_ERROR;
 }
@@ -330,12 +330,12 @@ njs_fs_read_file_sync(njs_vm_t *vm, njs_
     nxt_lvlhsh_query_t  lhq;
 
     if (nxt_slow_path(nargs < 2)) {
-        njs_exception_type_error(vm, "too few arguments", NULL);
+        njs_type_error(vm, "too few arguments", NULL);
         return NJS_ERROR;
     }
 
     if (nxt_slow_path(!njs_is_string(&args[1]))) {
-        njs_exception_type_error(vm, "path must be a string", NULL);
+        njs_type_error(vm, "path must be a string", NULL);
         return NJS_ERROR;
     }
 
@@ -369,8 +369,8 @@ njs_fs_read_file_sync(njs_vm_t *vm, njs_
             }
 
         } else {
-            njs_exception_type_error(vm, "Unknown options type "
-                                     "(a string or object required)", NULL);
+            njs_type_error(vm, "Unknown options type "
+                           "(a string or object required)", NULL);
             return NJS_ERROR;
         }
     }
@@ -381,8 +381,8 @@ njs_fs_read_file_sync(njs_vm_t *vm, njs_
 
     flags = njs_fs_flags(&flag);
     if (nxt_slow_path(flags == -1)) {
-        njs_exception_type_error(vm, "Unknown file open flags: '%.*s'",
-                                 (int) flag.length, flag.start);
+        njs_type_error(vm, "Unknown file open flags: '%.*s'",
+                       (int) flag.length, flag.start);
         return NJS_ERROR;
     }
 
@@ -394,8 +394,8 @@ njs_fs_read_file_sync(njs_vm_t *vm, njs_
     if (encoding.length != 0
         && (encoding.length != 4 || memcmp(encoding.start, "utf8", 4) != 0))
     {
-        njs_exception_type_error(vm, "Unknown encoding: '%.*s'",
-                                 (int) encoding.length, encoding.start);
+        njs_type_error(vm, "Unknown encoding: '%.*s'",
+                       (int) encoding.length, encoding.start);
         return NJS_ERROR;
     }
 
@@ -495,7 +495,7 @@ memory_error:
         (void) close(fd);
     }
 
-    njs_exception_memory_error(vm);
+    njs_memory_error(vm);
 
     return NJS_ERROR;
 }
@@ -551,17 +551,17 @@ static njs_ret_t njs_fs_write_file_inter
     nxt_lvlhsh_query_t  lhq;
 
     if (nxt_slow_path(nargs < 4)) {
-        njs_exception_type_error(vm, "too few arguments", NULL);
+        njs_type_error(vm, "too few arguments", NULL);
         return NJS_ERROR;
     }
 
     if (nxt_slow_path(!njs_is_string(&args[1]))) {
-        njs_exception_type_error(vm, "path must be a string", NULL);
+        njs_type_error(vm, "path must be a string", NULL);
         return NJS_ERROR;
     }
 
     if (nxt_slow_path(!njs_is_string(&args[2]))) {
-        njs_exception_type_error(vm, "data must be a string", NULL);
+        njs_type_error(vm, "data must be a string", NULL);
         return NJS_ERROR;
     }
 
@@ -608,13 +608,13 @@ static njs_ret_t njs_fs_write_file_inter
             }
 
         } else {
-            njs_exception_type_error(vm, "Unknown options type "
-                                     "(a string or object required)", NULL);
+            njs_type_error(vm, "Unknown options type "
+                           "(a string or object required)", NULL);
             return NJS_ERROR;
         }
 
         if (nxt_slow_path(nargs < 5 || !njs_is_function(&args[4]))) {
-            njs_exception_type_error(vm, "callback must be a function", NULL);
+            njs_type_error(vm, "callback must be a function", NULL);
             return NJS_ERROR;
         }
 
@@ -622,7 +622,7 @@ static njs_ret_t njs_fs_write_file_inter
 
     } else {
         if (nxt_slow_path(!njs_is_function(&args[3]))) {
-            njs_exception_type_error(vm, "callback must be a function", NULL);
+            njs_type_error(vm, "callback must be a function", NULL);
             return NJS_ERROR;
         }
 
@@ -632,8 +632,8 @@ static njs_ret_t njs_fs_write_file_inter
     if (flag.start != NULL) {
         flags = njs_fs_flags(&flag);
         if (nxt_slow_path(flags == -1)) {
-            njs_exception_type_error(vm, "Unknown file open flags: '%.*s'",
-                                     (int) flag.length, flag.start);
+            njs_type_error(vm, "Unknown file open flags: '%.*s'",
+                           (int) flag.length, flag.start);
             return NJS_ERROR;
         }
 
@@ -656,8 +656,8 @@ static njs_ret_t njs_fs_write_file_inter
     if (encoding.length != 0
         && (encoding.length != 4 || memcmp(encoding.start, "utf8", 4) != 0))
     {
-        njs_exception_type_error(vm, "Unknown encoding: '%.*s'",
-                                 (int) encoding.length, encoding.start);
+        njs_type_error(vm, "Unknown encoding: '%.*s'",
+                       (int) encoding.length, encoding.start);
         return NJS_ERROR;
     }
 
@@ -740,17 +740,17 @@ njs_fs_write_file_sync_internal(njs_vm_t
     nxt_lvlhsh_query_t  lhq;
 
     if (nxt_slow_path(nargs < 3)) {
-        njs_exception_type_error(vm, "too few arguments", NULL);
+        njs_type_error(vm, "too few arguments", NULL);
         return NJS_ERROR;
     }
 
     if (nxt_slow_path(!njs_is_string(&args[1]))) {
-        njs_exception_type_error(vm, "path must be a string", NULL);
+        njs_type_error(vm, "path must be a string", NULL);
         return NJS_ERROR;
     }
 
     if (nxt_slow_path(!njs_is_string(&args[2]))) {
-        njs_exception_type_error(vm, "data must be a string", NULL);
+        njs_type_error(vm, "data must be a string", NULL);
         return NJS_ERROR;
     }
 
@@ -797,8 +797,8 @@ njs_fs_write_file_sync_internal(njs_vm_t
             }
 
         } else {
-            njs_exception_type_error(vm, "Unknown options type "
-                                     "(a string or object required)", NULL);
+            njs_type_error(vm, "Unknown options type "
+                           "(a string or object required)", NULL);
             return NJS_ERROR;
         }
     }
@@ -806,8 +806,8 @@ njs_fs_write_file_sync_internal(njs_vm_t
     if (flag.start != NULL) {
         flags = njs_fs_flags(&flag);
         if (nxt_slow_path(flags == -1)) {
-            njs_exception_type_error(vm, "Unknown file open flags: '%.*s'",
-                                     (int) flag.length, flag.start);
+            njs_type_error(vm, "Unknown file open flags: '%.*s'",
+                           (int) flag.length, flag.start);
             return NJS_ERROR;
         }
 
@@ -830,8 +830,8 @@ njs_fs_write_file_sync_internal(njs_vm_t
     if (encoding.length != 0
         && (encoding.length != 4 || memcmp(encoding.start, "utf8", 4) != 0))
     {
-        njs_exception_type_error(vm, "Unknown encoding: '%.*s'",
-                                 (int) encoding.length, encoding.start);
+        njs_type_error(vm, "Unknown encoding: '%.*s'",
+                       (int) encoding.length, encoding.start);
         return NJS_ERROR;
     }
 
@@ -944,7 +944,7 @@ static njs_ret_t njs_fs_error(njs_vm_t *
 
         ret = nxt_lvlhsh_insert(&error->hash, &lhq);
         if (nxt_slow_path(ret != NXT_OK)) {
-            njs_exception_internal_error(vm, NULL, NULL);
+            njs_internal_error(vm, NULL, NULL);
             return NJS_ERROR;
         }
     }
@@ -963,7 +963,7 @@ static njs_ret_t njs_fs_error(njs_vm_t *
 
         ret = nxt_lvlhsh_insert(&error->hash, &lhq);
         if (nxt_slow_path(ret != NXT_OK)) {
-            njs_exception_internal_error(vm, NULL, NULL);
+            njs_internal_error(vm, NULL, NULL);
             return NJS_ERROR;
         }
     }
@@ -988,7 +988,7 @@ static njs_ret_t njs_fs_error(njs_vm_t *
 
         ret = nxt_lvlhsh_insert(&error->hash, &lhq);
         if (nxt_slow_path(ret != NXT_OK)) {
-            njs_exception_internal_error(vm, NULL, NULL);
+            njs_internal_error(vm, NULL, NULL);
             return NJS_ERROR;
         }
     }
@@ -1001,7 +1001,7 @@ static njs_ret_t njs_fs_error(njs_vm_t *
 
 memory_error:
 
-    njs_exception_memory_error(vm);
+    njs_memory_error(vm);
 
     return NJS_ERROR;
 }
diff -r 9dfa2e1892d0 -r ecf693afd698 njs/njs_function.c
--- a/njs/njs_function.c	Fri Mar 23 14:03:09 2018 +0300
+++ b/njs/njs_function.c	Tue Mar 27 19:11:04 2018 +0300
@@ -256,8 +256,7 @@ njs_function_frame_alloc(njs_vm_t *vm, s
         spare_size = nxt_align_size(spare_size, NJS_FRAME_SPARE_SIZE);
 
         if (vm->stack_size + spare_size > NJS_MAX_STACK_SIZE) {
-            njs_exception_range_error(vm, "Maximum call stack size exceeded",
-                                      NULL);
+            njs_range_error(vm, "Maximum call stack size exceeded", NULL);
             return NULL;
         }
 
@@ -518,7 +517,7 @@ njs_function_prototype_call(njs_vm_t *vm
     njs_function_t  *function;
 
     if (!njs_is_function(&args[0])) {
-        njs_exception_type_error(vm, "'this' argument is not a function", NULL);
+        njs_type_error(vm, "'this' argument is not a function", NULL);
         return NXT_ERROR;
     }
 
@@ -546,7 +545,7 @@ njs_function_prototype_apply(njs_vm_t *v
     njs_function_t  *function;
 
     if (!njs_is_function(&args[0])) {
-        njs_exception_type_error(vm, "'this' argument is not a function", NULL);
+        njs_type_error(vm, "'this' argument is not a function", NULL);
         return NXT_ERROR;
     }
 
@@ -555,8 +554,7 @@ njs_function_prototype_apply(njs_vm_t *v
 
     if (nargs > 2) {
         if (!njs_is_array(&args[2])) {
-            njs_exception_type_error(vm, "second argument is not an array",
-                                     NULL);
+            njs_type_error(vm, "second argument is not an array", NULL);
             return NXT_ERROR;
         }
 
@@ -628,7 +626,7 @@ njs_function_prototype_bind(njs_vm_t *vm
     njs_function_t  *function;
 
     if (!njs_is_function(&args[0])) {
-        njs_exception_type_error(vm, "'this' argument is not a function", NULL);
+        njs_type_error(vm, "'this' argument is not a function", NULL);
         return NXT_ERROR;
     }
 
@@ -707,7 +705,7 @@ njs_ret_t
 njs_eval_function(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,
     njs_index_t unused)
 {
-    njs_exception_internal_error(vm, "Not implemented", NULL);
+    njs_internal_error(vm, "Not implemented", NULL);
 
     return NXT_ERROR;
 }
diff -r 9dfa2e1892d0 -r ecf693afd698 njs/njs_generator.c
--- a/njs/njs_generator.c	Fri Mar 23 14:03:09 2018 +0300
+++ b/njs/njs_generator.c	Tue Mar 27 19:11:04 2018 +0300
@@ -344,7 +344,7 @@ njs_generator(njs_vm_t *vm, njs_parser_t
 
     default:
         nxt_thread_log_debug("unknown token: %d", node->token);
-        njs_exception_syntax_error(vm, "unknown token", NULL);
+        njs_syntax_error(vm, "unknown token", NULL);
 
         return NXT_ERROR;
     }
@@ -2082,7 +2082,7 @@ njs_generate_scope(njs_vm_t *vm, njs_par
                          parser->code_size, code_size);
 
     if (nxt_slow_path(parser->code_size < code_size)) {
-        njs_exception_internal_error(vm, NULL, NULL);
+        njs_internal_error(vm, NULL, NULL);
         return NXT_ERROR;
     }
 
diff -r 9dfa2e1892d0 -r ecf693afd698 njs/njs_json.c
--- a/njs/njs_json.c	Fri Mar 23 14:03:09 2018 +0300
+++ b/njs/njs_json.c	Tue Mar 27 19:11:04 2018 +0300
@@ -187,7 +187,7 @@ njs_json_parse(njs_vm_t *vm, njs_value_t
 
     value = nxt_mem_cache_alloc(vm->mem_cache_pool, sizeof(njs_value_t));
     if (nxt_slow_path(value == NULL)) {
-        njs_exception_memory_error(vm);
+        njs_memory_error(vm);
         return NXT_ERROR;
     }
 
@@ -255,7 +255,7 @@ njs_json_parse(njs_vm_t *vm, njs_value_t
 
 memory_error:
 
-    njs_exception_memory_error(vm);
+    njs_memory_error(vm);
 
     return NXT_ERROR;
 }
@@ -342,7 +342,7 @@ njs_json_stringify(njs_vm_t *vm, njs_val
 
 memory_error:
 
-    njs_exception_memory_error(vm);
+    njs_memory_error(vm);
 
     return NXT_ERROR;
 }
@@ -487,7 +487,7 @@ njs_json_parse_object(njs_json_parse_ctx
 
         ret = nxt_lvlhsh_insert(&object->hash, &lhq);
         if (nxt_slow_path(ret != NXT_OK)) {
-            njs_exception_internal_error(ctx->vm, NULL, NULL);
+            njs_internal_error(ctx->vm, NULL, NULL);
             return NULL;
         }
 
@@ -527,7 +527,7 @@ error_end:
 
 memory_error:
 
-    njs_exception_memory_error(ctx->vm);
+    njs_memory_error(ctx->vm);
 
     return NULL;
 }
@@ -547,7 +547,7 @@ njs_json_parse_array(njs_json_parse_ctx_
 
     array = njs_array_alloc(ctx->vm, 0, 0);
     if (nxt_slow_path(array == NULL)) {
-        njs_exception_memory_error(ctx->vm);
+        njs_memory_error(ctx->vm);
         return NULL;
     }
 
@@ -570,7 +570,7 @@ njs_json_parse_array(njs_json_parse_ctx_
 
         element = nxt_mem_cache_alloc(ctx->pool, sizeof(njs_value_t));
         if (nxt_slow_path(element == NULL)) {
-            njs_exception_memory_error(ctx->vm);
+            njs_memory_error(ctx->vm);
             return NULL;
         }
 
@@ -581,7 +581,7 @@ njs_json_parse_array(njs_json_parse_ctx_
 
         ret = njs_array_add(ctx->vm, array, element);
         if (nxt_slow_path(ret != NXT_OK)) {
-            njs_exception_internal_error(ctx->vm, NULL, NULL);
+            njs_internal_error(ctx->vm, NULL, NULL);
             return NULL;
         }
 
@@ -736,7 +736,7 @@ njs_json_parse_string(njs_json_parse_ctx
 
         start = nxt_mem_cache_alloc(ctx->pool, size);
         if (nxt_slow_path(start == NULL)) {
-            njs_exception_memory_error(ctx->vm);;
+            njs_memory_error(ctx->vm);;
             return NULL;
         }
 
@@ -821,7 +821,7 @@ njs_json_parse_string(njs_json_parse_ctx
 
     ret = njs_string_create(ctx->vm, value, start, size, length);
     if (nxt_slow_path(ret != NXT_OK)) {
-        njs_exception_memory_error(ctx->vm);
+        njs_memory_error(ctx->vm);
         return NULL;
     }
 
@@ -992,7 +992,7 @@ njs_json_parse_continuation(njs_vm_t *vm
             }
 
             if (nxt_slow_path(ret != NXT_OK)) {
-                njs_exception_internal_error(vm, NULL, NULL);
+                njs_internal_error(vm, NULL, NULL);
                 return NXT_ERROR;
             }
 
@@ -1030,14 +1030,14 @@ njs_json_parse_continuation(njs_vm_t *vm
             break;
 
         default:
-            njs_exception_internal_error(vm, NULL, NULL);
+            njs_internal_error(vm, NULL, NULL);
             return NXT_ERROR;
         }
     }
 
 memory_error:
 
-    njs_exception_memory_error(vm);
+    njs_memory_error(vm);
 
     return NXT_ERROR;
 }
@@ -1072,7 +1072,7 @@ njs_json_parse_continuation_apply(njs_vm
         break;
 
     default:
-        njs_exception_internal_error(vm, NULL, NULL);
+        njs_internal_error(vm, NULL, NULL);
         return NXT_ERROR;
     }
 
@@ -1139,7 +1139,7 @@ njs_json_parse_exception(njs_json_parse_
         length = 0;
     }
 
-    njs_exception_syntax_error(ctx->vm, "%s at position %zu", msg, length);
+    njs_syntax_error(ctx->vm, "%s at position %zu", msg, length);
 }
 
 
@@ -1431,7 +1431,7 @@ done:
 
 memory_error:
 
-    njs_exception_memory_error(vm);
+    njs_memory_error(vm);
 
     return NXT_ERROR;
 }
@@ -1495,7 +1495,7 @@ njs_json_stringify_to_json(njs_vm_t *vm,
         break;
 
     default:
-        njs_exception_internal_error(vm, NULL, NULL);
+        njs_internal_error(vm, NULL, NULL);
         return NXT_ERROR;
     }
 
@@ -1539,7 +1539,7 @@ njs_json_stringify_replacer(njs_vm_t *vm
         break;
 
     default:
-        njs_exception_internal_error(vm, NULL, NULL);
+        njs_internal_error(vm, NULL, NULL);
         return NXT_ERROR;
     }
 
@@ -1633,15 +1633,15 @@ njs_json_push_stringify_state(njs_vm_t *
     njs_json_state_t  *state;
 
     if (stringify->stack.items >= 32) {
-        njs_exception_type_error(stringify->vm,
-                                 "Nested too deep or a cyclic structure", NULL);
+        njs_type_error(stringify->vm,
+                       "Nested too deep or a cyclic structure", NULL);
         return NULL;
     }
 
     state = nxt_array_add(&stringify->stack, &njs_array_mem_proto,
                            vm->mem_cache_pool);
     if (nxt_slow_path(state == NULL)) {
-        njs_exception_memory_error(vm);
+        njs_memory_error(vm);
         return NULL;
     }
 
@@ -1723,8 +1723,7 @@ njs_json_append_value(njs_json_stringify
         return njs_json_buf_append(stringify, "null", 4);
 
     default:
-        njs_exception_type_error(stringify->vm, "Non-serializable object",
-                                 NULL);
+        njs_type_error(stringify->vm, "Non-serializable object", NULL);
         return NXT_DECLINED;
     }
 }
diff -r 9dfa2e1892d0 -r ecf693afd698 njs/njs_module.c
--- a/njs/njs_module.c	Fri Mar 23 14:03:09 2018 +0300
+++ b/njs/njs_module.c	Tue Mar 27 19:11:04 2018 +0300
@@ -59,7 +59,7 @@ njs_ret_t njs_module_require(njs_vm_t *v
     nxt_lvlhsh_query_t  lhq;
 
     if (nargs < 2) {
-        njs_exception_type_error(vm, "missing path", NULL);
+        njs_type_error(vm, "missing path", NULL);
         return NJS_ERROR;
     }
 
@@ -78,8 +78,8 @@ njs_ret_t njs_module_require(njs_vm_t *v
         return NXT_OK;
     }
 
-    njs_exception_error(vm, "Cannot find module '%.*s'", (int) lhq.key.length,
-                        lhq.key.start);
+    njs_error(vm, "Cannot find module '%.*s'",
+              (int) lhq.key.length, lhq.key.start);
 
     return NJS_ERROR;
 }
diff -r 9dfa2e1892d0 -r ecf693afd698 njs/njs_number.c
--- a/njs/njs_number.c	Fri Mar 23 14:03:09 2018 +0300
+++ b/njs/njs_number.c	Tue Mar 27 19:11:04 2018 +0300
@@ -586,8 +586,8 @@ njs_number_prototype_value_of(njs_vm_t *
             value = &value->data.u.object_value->value;
 
         } else {
-            njs_exception_type_error(vm, "unexpected value type:%s",
-                                     njs_type_string(value->type));
+            njs_type_error(vm, "unexpected value type:%s",
+                           njs_type_string(value->type));
             return NXT_ERROR;
         }
     }
@@ -613,8 +613,8 @@ njs_number_prototype_to_string(njs_vm_t 
             value = &value->data.u.object_value->value;
 
         } else {
-            njs_exception_type_error(vm, "unexpected value type:%s",
-                                     njs_type_string(value->type));
+            njs_type_error(vm, "unexpected value type:%s",
+                           njs_type_string(value->type));
             return NXT_ERROR;
         }
     }
@@ -623,7 +623,7 @@ njs_number_prototype_to_string(njs_vm_t 
         radix = args[1].data.u.number;
 
         if (radix < 2 || radix > 36 || radix != (int) radix) {
-            njs_exception_range_error(vm, NULL, NULL);
+            njs_range_error(vm, NULL, NULL);
             return NXT_ERROR;
         }
 
diff -r 9dfa2e1892d0 -r ecf693afd698 njs/njs_object.c
--- a/njs/njs_object.c	Fri Mar 23 14:03:09 2018 +0300
+++ b/njs/njs_object.c	Tue Mar 27 19:11:04 2018 +0300
@@ -262,8 +262,8 @@ njs_object_constructor(njs_vm_t *vm, njs
             type = njs_object_value_type(value->type);
 
         } else {
-            njs_exception_type_error(vm, "unexpected constructor argument:%s",
-                                     njs_type_string(value->type));
+            njs_type_error(vm, "unexpected constructor argument:%s",
+                           njs_type_string(value->type));
 
             return NXT_ERROR;
         }
@@ -310,7 +310,7 @@ njs_object_create(njs_vm_t *vm, njs_valu
         }
     }
 
-    njs_exception_type_error(vm, "too few arguments", NULL);
+    njs_type_error(vm, "too few arguments", NULL);
 
     return NXT_ERROR;
 }
@@ -323,16 +323,15 @@ njs_object_keys(njs_vm_t *vm, njs_value_
     njs_array_t  *keys;
 
     if (nargs < 2 || !njs_is_object(&args[1])) {
-        njs_exception_type_error(vm, "cannot convert %s argument to object",
-                                 (nargs >= 2) ? njs_type_string(args[1].type)
-                                              : "null");
+        njs_type_error(vm, "cannot convert %s argument to object",
+                       (nargs >= 2) ? njs_type_string(args[1].type) : "null");
 
         return NXT_ERROR;
     }
 
     keys = njs_object_keys_array(vm, &args[1]);
     if (keys == NULL) {
-        njs_exception_memory_error(vm);
+        njs_memory_error(vm);
         return NXT_ERROR;
     }
 
@@ -433,18 +432,17 @@ njs_object_define_property(njs_vm_t *vm,
     if (nargs < 4 || !njs_is_object(&args[1]) || !njs_is_object(&args[3])) {
         if (nargs < 2 || !njs_is_object(&args[1])) {
             type = (nargs > 1) ? njs_type_string(args[1].type) : "null";
-            njs_exception_type_error(vm, "cannot convert %s argument to object",
-                                     type);
+            njs_type_error(vm, "cannot convert %s argument to object", type);
 
         } else {
-            njs_exception_type_error(vm, "descriptor is not an object", NULL);
+            njs_type_error(vm, "descriptor is not an object", NULL);
         }
 
         return NXT_ERROR;
     }
 
     if (!args[1].data.u.object->extensible) {
-        njs_exception_type_error(vm, "object is not extensible", NULL);
+        njs_type_error(vm, "object is not extensible", NULL);
         return NXT_ERROR;
     }
 
@@ -475,18 +473,17 @@ njs_object_define_properties(njs_vm_t *v
     if (nargs < 3 || !njs_is_object(&args[1]) || !njs_is_object(&args[2])) {
         if (nargs < 2 || !njs_is_object(&args[1])) {
             type = (nargs > 1) ? njs_type_string(args[1].type) : "null";
-            njs_exception_type_error(vm, "cannot convert %s argument to object",
-                                     type);
+            njs_type_error(vm, "cannot convert %s argument to object", type);
 
         } else {
-            njs_exception_type_error(vm, "descriptor is not an object", NULL);
+            njs_type_error(vm, "descriptor is not an object", NULL);
         }
 
         return NXT_ERROR;
     }
 


More information about the nginx-devel mailing list