]> git.kaiwu.me - njs.git/commitdiff
Short exception macros' names.
authorDmitry Volyntsev <xeioex@nginx.com>
Tue, 27 Mar 2018 16:11:04 +0000 (19:11 +0300)
committerDmitry Volyntsev <xeioex@nginx.com>
Tue, 27 Mar 2018 16:11:04 +0000 (19:11 +0300)
21 files changed:
njs/njs_array.c
njs/njs_boolean.c
njs/njs_builtin.c
njs/njs_date.c
njs/njs_error.c
njs/njs_error.h
njs/njs_event.c
njs/njs_fs.c
njs/njs_function.c
njs/njs_generator.c
njs/njs_json.c
njs/njs_module.c
njs/njs_number.c
njs/njs_object.c
njs/njs_parser.c
njs/njs_parser_expression.c
njs/njs_regexp.c
njs/njs_string.c
njs/njs_time.c
njs/njs_variable.c
njs/njs_vm.c

index a1f81131ccbd1547959bc252f3970b3beaf711bf..800fbb82e864d08563b27f9b1b86c66ed00c2944 100644 (file)
@@ -249,7 +249,7 @@ njs_array_constructor(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,
         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, njs_value_t *args, nxt_uint_t nargs,
         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, njs_value_t *args, nxt_uint_t nargs)
         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_t *vm, njs_value_t *args,
         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;
         }
index 2b258f425c260ae64bd9584f8803ef404a774871..275d526f80bc2ae7cc6d80fc1d5a4896a929715e 100644 (file)
@@ -99,8 +99,8 @@ njs_boolean_prototype_value_of(njs_vm_t *vm, njs_value_t *args,
             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 *vm, njs_value_t *args,
             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;
         }
     }
index 9c9a7bfb3318bcbad9b73584ed63053987bb1e77..84ba35929ee161ec07846748263ee72c52617368 100644 (file)
@@ -75,7 +75,7 @@ const njs_object_init_t  *njs_prototype_init[] = {
     &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_constructor_init[] = {
     &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 } },
index 79d8f32515201b099dad94e3741ead85256385f7..b8bc0fe744f56b07c960f0052be58bb2c8c131b5 100644 (file)
@@ -1063,7 +1063,7 @@ njs_date_prototype_to_iso_string(njs_vm_t *vm, njs_value_t *args,
         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_value_t *args, nxt_uint_t nargs,
         }
     }
 
-    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;
 }
index e46dcd6ef30a438bbb8891fe8afae44832f16075..441ab3e2833a2cc3220380cbf1b06833c9e20597 100644 (file)
@@ -68,7 +68,7 @@ njs_exception_error_create(njs_vm_t *vm, njs_value_type_t type,
 
 memory_error:
 
-    njs_exception_memory_error(vm);
+    njs_memory_error(vm);
 }
 
 
@@ -154,7 +154,7 @@ njs_error_create(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,
 
     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_constructor_init = {
 
 
 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_error_constructor_properties[] =
 };
 
 
-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_value_t *value)
 
 
 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 *vm, njs_value_t *args, nxt_uint_t nargs,
     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 *vm, njs_value_t *args, nxt_uint_t nargs,
         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_prototype_init = {
 };
 
 
-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_error_prototype_properties[] =
 };
 
 
-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),
 };
 
 
index 97561be1c3b2a1f5fb3dcd9ff57ed3d26b9609f6..719ecb6d4ed16cbe0997daf979c27d8da32b8e1c 100644 (file)
@@ -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(njs_vm_t *vm, njs_value_t *args,
     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_error_constructor_init;
 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_error_prototype_init;
 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;
index 2ac90d37afe6786c0711a56308b3d87c335113e8..5cc0f3d1c2aaf9c01e4bdbb500ad14f7854f948a 100644 (file)
@@ -79,8 +79,8 @@ njs_add_event(njs_vm_t *vm, njs_event_t *event)
 
     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;
index ff28136deda87f98478c0c2168d0bb1ded080024..9281c5772c8ca84d1e1ea5747a0c979ded8aa887 100644 (file)
@@ -116,12 +116,12 @@ njs_fs_read_file(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,
     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_t *args, nxt_uint_t nargs,
             }
 
         } 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_t *args, nxt_uint_t nargs,
 
     } 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_t *args, nxt_uint_t nargs,
 
     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_t *args, nxt_uint_t nargs,
     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_value_t *args, nxt_uint_t nargs,
     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_value_t *args, nxt_uint_t nargs,
             }
 
         } 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_value_t *args, nxt_uint_t nargs,
 
     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_value_t *args, nxt_uint_t nargs,
     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_internal(njs_vm_t *vm, njs_value_t *args,
     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_internal(njs_vm_t *vm, njs_value_t *args,
             }
 
         } 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_internal(njs_vm_t *vm, njs_value_t *args,
 
     } 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_internal(njs_vm_t *vm, njs_value_t *args,
     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_internal(njs_vm_t *vm, njs_value_t *args,
     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 *vm, njs_value_t *args,
     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 *vm, njs_value_t *args,
             }
 
         } 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 *vm, njs_value_t *args,
     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 *vm, njs_value_t *args,
     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 *vm, const char *syscall,
 
         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 *vm, const char *syscall,
 
         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 *vm, const char *syscall,
 
         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 *vm, const char *syscall,
 
 memory_error:
 
-    njs_exception_memory_error(vm);
+    njs_memory_error(vm);
 
     return NJS_ERROR;
 }
index 6606614f6be8c82f39b82e95924046d14f944442..d35c4bca5a76ba6506917e7d9bd0d72ebcd0178a 100644 (file)
@@ -256,8 +256,7 @@ njs_function_frame_alloc(njs_vm_t *vm, size_t size)
         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_value_t *args, nxt_uint_t nargs,
     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 *vm, njs_value_t *args, nxt_uint_t nargs,
     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 *vm, njs_value_t *args, nxt_uint_t nargs,
 
     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_value_t *args, nxt_uint_t nargs,
     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;
 }
index 57be2d50810e49edffa42a4c69f5dd1467a61a10..7e73a1a2fc5e05687e4bd57e005fdab2f90a0d95 100644 (file)
@@ -344,7 +344,7 @@ njs_generator(njs_vm_t *vm, njs_parser_t *parser, njs_parser_node_t *node)
 
     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_parser_t *parser, njs_parser_node_t *node)
                          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;
     }
 
index 636ab838c39732afd94ec58fa787859216baeb54..9ad86d0c351198ce8d869e92df41ed6b63bc04ea 100644 (file)
@@ -187,7 +187,7 @@ njs_json_parse(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,
 
     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 *args, nxt_uint_t nargs,
 
 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_value_t *args, nxt_uint_t nargs,
 
 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_t *ctx, njs_value_t *value, u_char *p)
 
         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_t *ctx, njs_value_t *value, u_char *p)
 
     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_t *ctx, njs_value_t *value, u_char *p)
 
         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_t *ctx, njs_value_t *value, u_char *p)
 
         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_t *ctx, njs_value_t *value, u_char *p)
 
         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_t *ctx, njs_value_t *value, u_char *p)
 
     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, njs_value_t *args, nxt_uint_t nargs,
             }
 
             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, njs_value_t *args, nxt_uint_t nargs,
             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_t *vm, njs_json_parse_t *parse)
         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_ctx_t *ctx, const char* msg,
         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, njs_json_stringify_t* stringify,
         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, njs_json_stringify_t* stringify,
         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 *vm, njs_json_stringify_t *stringify,
     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_t *stringify, njs_value_t *value)
         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;
     }
 }
index 83a77cb8ada7b6b6a6be93330d12d1a3a50d2bff..d3dd0f2a54111c3c9e67c87bf179de278f9b900f 100644 (file)
@@ -59,7 +59,7 @@ njs_ret_t njs_module_require(njs_vm_t *vm, njs_value_t *args,
     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 *vm, njs_value_t *args,
         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;
 }
index 433aee864f21bd7d00a9eba729aa24f71f6e281c..99abd2d66f35a3380acd874efdb508d47134419e 100644 (file)
@@ -586,8 +586,8 @@ njs_number_prototype_value_of(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,
             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 *vm, njs_value_t *args,
             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 *vm, njs_value_t *args,
         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;
         }
 
index 8983bc7b4c1994e28392ca2adfa68ab05434788c..9d78861bcfaa5e17ea51ac78cb7cd95d0e4c884b 100644 (file)
@@ -262,8 +262,8 @@ njs_object_constructor(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,
             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_value_t *args, nxt_uint_t nargs,
         }
     }
 
-    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_t *args, nxt_uint_t nargs,
     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, njs_value_t *args, nxt_uint_t nargs,
     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 *vm, njs_value_t *args, nxt_uint_t nargs,
     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;
     }
 
     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;
     }
 
@@ -618,8 +615,7 @@ njs_object_get_own_property_descriptor(njs_vm_t *vm, njs_value_t *args,
 
     if (nargs < 3 || !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);
         return NXT_ERROR;
     }
 
@@ -748,9 +744,8 @@ njs_object_get_prototype_of(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,
         return NXT_OK;
     }
 
-    njs_exception_type_error(vm, "cannot convert %s argument to object",
-                             (nargs > 1) ? njs_type_string(args[1].type)
-                                         : "null");
+    njs_type_error(vm, "cannot convert %s argument to object",
+                   (nargs > 1) ? njs_type_string(args[1].type) : "null");
     return NXT_ERROR;
 }
 
@@ -1069,7 +1064,7 @@ njs_property_prototype_create(njs_vm_t *vm, nxt_lvlhsh_t *hash,
     }
 
     /* Memory allocation or NXT_DECLINED error. */
-    njs_exception_internal_error(vm, NULL, NULL);
+    njs_internal_error(vm, NULL, NULL);
 
     return NULL;
 }
@@ -1312,7 +1307,7 @@ njs_property_constructor_create(njs_vm_t *vm, nxt_lvlhsh_t *hash,
     }
 
     /* Memory allocation or NXT_DECLINED error. */
-    njs_exception_internal_error(vm, NULL, NULL);
+    njs_internal_error(vm, NULL, NULL);
 
     return NULL;
 }
index 77cbccf709c633b9a8995f26f5224b3b7a2ce4a0..7b33e7e7c44727a5d0df990eb33c598af51d0f8f 100644 (file)
@@ -1688,8 +1688,8 @@ njs_parser_try_statement(njs_vm_t *vm, njs_parser_t *parser)
     }
 
     if (try->right == NULL) {
-        njs_parser_syntax_error(vm, parser, "Missing catch or "
-                                "finally after try", NULL);
+        njs_parser_syntax_error(vm, parser,
+                                "Missing catch or finally after try", NULL);
 
         return NJS_TOKEN_ILLEGAL;
     }
@@ -2618,10 +2618,9 @@ njs_parser_trace_handler(nxt_trace_t *trace, nxt_trace_data_t *td,
     p = trace->handler(trace, td, p);
 
     if (vm->parser != NULL) {
-        njs_exception_internal_error(vm, "%s in %u", start,
-                                     vm->parser->lexer->line);
+        njs_internal_error(vm, "%s in %u", start, vm->parser->lexer->line);
     } else {
-        njs_exception_internal_error(vm, "%s", start);
+        njs_internal_error(vm, "%s", start);
     }
 
     return p;
@@ -2640,7 +2639,7 @@ njs_parser_syntax_error(njs_vm_t *vm, njs_parser_t *parser, const char* fmt,
     (void) vsnprintf(buf, sizeof(buf), fmt, args);
     va_end(args);
 
-    njs_exception_syntax_error(vm, "%s in %u", buf, parser->lexer->line);
+    njs_syntax_error(vm, "%s in %u", buf, parser->lexer->line);
 }
 
 
@@ -2656,5 +2655,5 @@ njs_parser_ref_error(njs_vm_t *vm, njs_parser_t *parser, const char* fmt,
     (void) vsnprintf(buf, sizeof(buf), fmt, args);
     va_end(args);
 
-    njs_exception_ref_error(vm, "%s in %u", buf, parser->lexer->line);
+    njs_reference_error(vm, "%s in %u", buf, parser->lexer->line);
 }
index 379d8037e3cba4f0c1963cefc1a07825b05463af..a37d69f1a013ccdb94a301c95f08efdcbb27f0cb 100644 (file)
@@ -432,8 +432,8 @@ njs_parser_assignment_expression(njs_vm_t *vm, njs_parser_t *parser,
         }
 
         if (!njs_parser_is_lvalue(parser->node)) {
-            njs_parser_ref_error(vm, parser, "Invalid left-hand side "
-                                 "in assignment", NULL);
+            njs_parser_ref_error(vm, parser,
+                                 "Invalid left-hand side in assignment", NULL);
             return NJS_TOKEN_ILLEGAL;
         }
 
@@ -855,8 +855,9 @@ njs_parser_inc_dec_expression(njs_vm_t *vm, njs_parser_t *parser,
     }
 
     if (!njs_parser_is_lvalue(parser->node)) {
-        njs_parser_ref_error(vm, parser, "Invalid left-hand side "
-                             "in prefix operation", NULL);
+        njs_parser_ref_error(vm, parser,
+                             "Invalid left-hand side in prefix operation",
+                             NULL);
         return NJS_TOKEN_ILLEGAL;
     }
 
@@ -910,8 +911,9 @@ njs_parser_post_inc_dec_expression(njs_vm_t *vm, njs_parser_t *parser,
     }
 
     if (!njs_parser_is_lvalue(parser->node)) {
-        njs_parser_ref_error(vm, parser, "Invalid left-hand side "
-                             "in postfix operation", NULL);
+        njs_parser_ref_error(vm, parser,
+                             "Invalid left-hand side in postfix operation",
+                             NULL);
         return NJS_TOKEN_ILLEGAL;
     }
 
index 813cff7ad8921586e3fe49fd2d5e52114a78a1eb..2329542e33f67f390c9b5e5145ff63c0a5d622ae 100644 (file)
@@ -342,7 +342,7 @@ njs_regexp_pattern_create(njs_vm_t *vm, u_char *start, size_t length,
     if (nxt_fast_path(ret >= 0)) {
 
         if (nxt_slow_path((u_int) ret != pattern->ncaptures)) {
-            njs_exception_internal_error(vm, NULL, NULL);
+            njs_internal_error(vm, NULL, NULL);
             nxt_mem_cache_free(vm->mem_cache_pool, pattern);
             return NULL;
         }
@@ -394,11 +394,10 @@ njs_regexp_compile_trace_handler(nxt_trace_t *trace, nxt_trace_data_t *td,
     p = trace->handler(trace, td, start);
 
     if (vm->parser != NULL) {
-        njs_exception_syntax_error(vm, "%s in %u", start,
-                                   vm->parser->lexer->line);
+        njs_syntax_error(vm, "%s in %u", start, vm->parser->lexer->line);
 
     } else {
-        njs_exception_syntax_error(vm, "%s", start);
+        njs_syntax_error(vm, "%s", start);
     }
 
     return p;
@@ -435,7 +434,7 @@ njs_regexp_match_trace_handler(nxt_trace_t *trace, nxt_trace_data_t *td,
     trace = trace->next;
     p = trace->handler(trace, td, start);
 
-    njs_exception_internal_error(vm, (const char *) start, NULL);
+    njs_internal_error(vm, (const char *) start, NULL);
 
     return p;
 }
@@ -568,7 +567,7 @@ njs_regexp_prototype_to_string(njs_vm_t *vm, njs_value_t *args,
         return njs_regexp_string_create(vm, &vm->retval, source, size, length);
     }
 
-    njs_exception_type_error(vm, "'this' argument is not a regexp", NULL);
+    njs_type_error(vm, "'this' argument is not a regexp", NULL);
 
     return NXT_ERROR;
 }
@@ -586,7 +585,7 @@ njs_regexp_prototype_test(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,
     njs_regexp_pattern_t  *pattern;
 
     if (!njs_is_regexp(&args[0])) {
-        njs_exception_type_error(vm, "'this' argument is not a regexp", NULL);
+        njs_type_error(vm, "'this' argument is not a regexp", NULL);
         return NXT_ERROR;
     }
 
@@ -636,7 +635,7 @@ njs_regexp_prototype_exec(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,
     nxt_regex_match_data_t  *match_data;
 
     if (!njs_is_regexp(&args[0])) {
-        njs_exception_type_error(vm, "'this' argument is not a regexp", NULL);
+        njs_type_error(vm, "'this' argument is not a regexp", NULL);
         return NXT_ERROR;
     }
 
index cafde07b3c992c7563d3838e1b71d3b14ee72094..af6d7d75cfc396e17c2d6ba68e0d361dcb4009f5 100644 (file)
@@ -554,8 +554,8 @@ njs_string_prototype_value_of(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,
             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;
         }
     }
@@ -580,8 +580,7 @@ njs_string_prototype_concat(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,
     njs_string_prop_t  string;
 
     if (njs_is_null_or_void(&args[0])) {
-        njs_exception_type_error(vm, "'this' argument is null or undefined",
-                                 NULL);
+        njs_type_error(vm, "'this' argument is null or undefined", NULL);
         return NXT_ERROR;
     }
 
@@ -1176,7 +1175,7 @@ njs_string_from_char_code(njs_vm_t *vm, njs_value_t *args,
 
 range_error:
 
-    njs_exception_range_error(vm, NULL, NULL);
+    njs_range_error(vm, NULL, NULL);
 
     return NXT_ERROR;
 }
@@ -1843,7 +1842,7 @@ njs_string_prototype_repeat(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,
         n = args[1].data.u.number;
 
         if (nxt_slow_path(n < 0 || n >= max)) {
-            njs_exception_range_error(vm, NULL, NULL);
+            njs_range_error(vm, NULL, NULL);
             return NXT_ERROR;
         }
     }
@@ -2547,8 +2546,8 @@ njs_string_replace_regexp_continuation(njs_vm_t *vm, njs_value_t *args,
 
     nxt_regex_match_data_free(r->match_data, vm->regex_context);
 
-    njs_exception_internal_error(vm, "unexpected continuation retval type:%s",
-                                 njs_type_string(r->retval.type));
+    njs_internal_error(vm, "unexpected continuation retval type:%s",
+                       njs_type_string(r->retval.type));
 
     return NXT_ERROR;
 }
@@ -2660,8 +2659,8 @@ njs_string_replace_search_continuation(njs_vm_t *vm, njs_value_t *args,
         return njs_string_replace_join(vm, r);
     }
 
-    njs_exception_internal_error(vm, "unexpected continuation retval type:%s",
-                                 njs_type_string(r->retval.type));
+    njs_internal_error(vm, "unexpected continuation retval type:%s",
+                       njs_type_string(r->retval.type));
 
     return NXT_ERROR;
 }
@@ -3107,7 +3106,7 @@ njs_string_to_c_string(njs_vm_t *vm, njs_value_t *value)
 
     data = nxt_mem_cache_alloc(vm->mem_cache_pool, size + 1);
     if (nxt_slow_path(data == NULL)) {
-        njs_exception_memory_error(vm);
+        njs_memory_error(vm);
         return NULL;
     }
 
@@ -3657,7 +3656,7 @@ njs_string_decode(njs_vm_t *vm, njs_value_t *value, const uint32_t *reserve)
 
 uri_error:
 
-    njs_exception_uri_error(vm, NULL, NULL);
+    njs_uri_error(vm, NULL, NULL);
 
     return NXT_ERROR;
 }
index 40afefed00b96bde03c50bf3a5f63e4e8225c91c..f13a40626d08246b8544568bc648f9e764391f08 100644 (file)
@@ -37,19 +37,18 @@ njs_set_timeout(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,
     njs_vm_ops_t  *ops;
 
     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_function(&args[1]))) {
-        njs_exception_type_error(vm, "first arg must be a function", NULL);
+        njs_type_error(vm, "first arg must be a function", NULL);
         return NJS_ERROR;
     }
 
     ops = vm->ops;
     if (nxt_slow_path(ops == NULL)) {
-        njs_exception_internal_error(vm, "not supported by host environment",
-                                     NULL);
+        njs_internal_error(vm, "not supported by host environment", NULL);
         return NJS_ERROR;
     }
 
@@ -81,7 +80,7 @@ njs_set_timeout(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,
 
     event->host_event = ops->set_timer(vm->external, delay, event);
     if (event->host_event == NULL) {
-        njs_exception_internal_error(vm, "set_timer() failed", NULL);
+        njs_internal_error(vm, "set_timer() failed", NULL);
         return NJS_ERROR;
     }
 
@@ -89,7 +88,7 @@ njs_set_timeout(njs_vm_t *vm, njs_value_t *args, nxt_uint_t nargs,
 
 memory_error:
 
-    njs_exception_memory_error(vm);
+    njs_memory_error(vm);
     return NJS_ERROR;
 }
 
index dec0e55d004601075325fd17596615da98b02b62..2e29566995efe7f3b8190af933a7251b0e4919a3 100644 (file)
@@ -389,8 +389,7 @@ njs_variable_get(njs_vm_t *vm, njs_parser_node_t *node)
         index = (index >> NJS_SCOPE_SHIFT) + 1;
 
         if (index > 255 || vs.scope->argument_closures == 0) {
-            njs_exception_internal_error(vm, "too many argument closures",
-                                         NULL);
+            njs_internal_error(vm, "too many argument closures", NULL);
 
             return NULL;
         }
index 8070180f1ec6805fcde47aa1783e3c96007786c8..cc3820734f127166414c948d9d3f51045cd09e7f 100644 (file)
@@ -679,8 +679,8 @@ njs_vmcode_property_set(njs_vm_t *vm, njs_value_t *object,
     njs_vmcode_prop_set_t  *code;
 
     if (njs_is_primitive(object)) {
-        njs_exception_type_error(vm, "property set on primitive %s type",
-                                 njs_type_string(object->type));
+        njs_type_error(vm, "property set on primitive %s type",
+                       njs_type_string(object->type));
         return NXT_ERROR;
     }
 
@@ -803,7 +803,7 @@ njs_vmcode_property_in(njs_vm_t *vm, njs_value_t *object, njs_value_t *property)
 
     case NJS_PRIMITIVE_VALUE:
     case NJS_STRING_VALUE:
-        njs_exception_type_error(vm, "property in on a primitive value", NULL);
+        njs_type_error(vm, "property in on a primitive value", NULL);
 
         return NXT_ERROR;
 
@@ -1065,16 +1065,13 @@ njs_property_query(njs_vm_t *vm, njs_property_query_t *pq, njs_value_t *object,
 
             if (nxt_fast_path(ret == NXT_OK)) {
                 njs_string_get(&pq->value, &pq->lhq.key);
-                njs_exception_type_error(vm,
-                                      "cannot get property '%.*s' of undefined",
-                                      (int) pq->lhq.key.length,
-                                      pq->lhq.key.start);
+                njs_type_error(vm, "cannot get property '%.*s' of undefined",
+                               (int) pq->lhq.key.length, pq->lhq.key.start);
                 return NXT_ERROR;
             }
         }
 
-        njs_exception_type_error(vm,
-                            "cannot get property 'unknown' of undefined", NULL);
+        njs_type_error(vm, "cannot get property 'unknown' of undefined", NULL);
 
         return NXT_ERROR;
     }
@@ -1374,7 +1371,7 @@ njs_vmcode_instance_of(njs_vm_t *vm, njs_value_t *object,
     static njs_value_t prototype_string = njs_string("prototype");
 
     if (!njs_is_function(constructor)) {
-        njs_exception_type_error(vm, "right argument is not a function", NULL);
+        njs_type_error(vm, "right argument is not a function", NULL);
         return NXT_ERROR;
     }
 
@@ -2285,7 +2282,7 @@ njs_function_frame_create(njs_vm_t *vm, njs_value_t *value,
         }
     }
 
-    njs_exception_type_error(vm, "object is not callable", NULL);
+    njs_type_error(vm, "object is not callable", NULL);
 
     return NXT_ERROR;
 }
@@ -2371,9 +2368,9 @@ njs_vmcode_method_frame(njs_vm_t *vm, njs_value_t *object, njs_value_t *name)
         ret = nxt_lvlhsh_find(&ext_proto->hash, &pq.lhq);
 
         if (nxt_slow_path(ret != NXT_OK)) {
-            njs_exception_type_error(vm,
-                            "cannot find property '%.*s' of an external object",
-                            (int) pq.lhq.key.length, pq.lhq.key.start);
+            njs_type_error(vm,
+                           "cannot find property '%.*s' of an external object",
+                           (int) pq.lhq.key.length, pq.lhq.key.start);
             return NXT_ERROR;
 
         }
@@ -2381,7 +2378,7 @@ njs_vmcode_method_frame(njs_vm_t *vm, njs_value_t *object, njs_value_t *name)
         ext_proto = pq.lhq.value;
 
         if (nxt_slow_path(ext_proto->type != NJS_EXTERN_METHOD)) {
-            njs_exception_type_error(vm,
+            njs_type_error(vm,
                           "method '%.*s' of an external object is not callable",
                           (int) pq.lhq.key.length, pq.lhq.key.start);
             return NXT_ERROR;
@@ -2402,9 +2399,8 @@ njs_vmcode_method_frame(njs_vm_t *vm, njs_value_t *object, njs_value_t *name)
         return NXT_ERROR;
 
     default:
-        njs_exception_internal_error(vm, "method '%.*s' query failed:%d",
-                                     (int) pq.lhq.key.length, pq.lhq.key.start,
-                                     ret);
+        njs_internal_error(vm, "method '%.*s' query failed:%d",
+                           (int) pq.lhq.key.length, pq.lhq.key.start, ret);
         return NXT_ERROR;
     }
 
@@ -2631,9 +2627,8 @@ trap:
 
 type_error:
 
-    njs_exception_type_error(vm, "cannot convert %s to %s",
-                             njs_type_string(args->type),
-                             njs_arg_type_string(*args_types));
+    njs_type_error(vm, "cannot convert %s to %s", njs_type_string(args->type),
+                   njs_arg_type_string(*args_types));
 
     return NXT_ERROR;
 }
@@ -3396,8 +3391,8 @@ njs_primitive_value(njs_vm_t *vm, njs_value_t *value, nxt_uint_t hint)
                 }
 
                 if (ret == NXT_ERROR) {
-                    njs_exception_type_error(vm, "cannot evaluate an object's "
-                                             "value", NULL);
+                    njs_type_error(vm, "cannot evaluate an object's value",
+                                   NULL);
                 }
 
                 return ret;