[njs] Improved wording for InternalError messages.
Dmitry Volyntsev
xeioex at nginx.com
Fri Aug 31 13:56:55 UTC 2018
details: http://hg.nginx.org/njs/rev/25d3bb391edb
branches:
changeset: 597:25d3bb391edb
user: Dmitry Volyntsev <xeioex at nginx.com>
date: Fri Aug 31 16:55:35 2018 +0300
description:
Improved wording for InternalError messages.
diffstat:
njs/njs_error.c | 4 ++--
njs/njs_extern.c | 4 ++--
njs/njs_fs.c | 6 +++---
njs/njs_generator.c | 3 ++-
njs/njs_json.c | 17 ++++++++++-------
njs/njs_object.c | 16 ++++++++--------
njs/njs_regexp.c | 4 ++--
njs/njs_variable.c | 2 +-
8 files changed, 30 insertions(+), 26 deletions(-)
diffs (262 lines):
diff -r 7ccb11c88d27 -r 25d3bb391edb njs/njs_error.c
--- a/njs/njs_error.c Thu Aug 30 20:21:43 2018 +0300
+++ b/njs/njs_error.c Fri Aug 31 16:55:35 2018 +0300
@@ -87,7 +87,7 @@ njs_error_alloc(njs_vm_t *vm, njs_value_
ret = nxt_lvlhsh_insert(&error->hash, &lhq);
if (nxt_slow_path(ret != NXT_OK)) {
- njs_internal_error(vm, NULL);
+ njs_internal_error(vm, "lvlhsh insert failed");
return NULL;
}
}
@@ -108,7 +108,7 @@ njs_error_alloc(njs_vm_t *vm, njs_value_
ret = nxt_lvlhsh_insert(&error->hash, &lhq);
if (nxt_slow_path(ret != NXT_OK)) {
- njs_internal_error(vm, NULL);
+ njs_internal_error(vm, "lvlhsh insert failed");
return NULL;
}
}
diff -r 7ccb11c88d27 -r 25d3bb391edb njs/njs_extern.c
--- a/njs/njs_extern.c Thu Aug 30 20:21:43 2018 +0300
+++ b/njs/njs_extern.c Fri Aug 31 16:55:35 2018 +0300
@@ -144,7 +144,7 @@ njs_vm_external_add(njs_vm_t *vm, nxt_lv
ret = nxt_lvlhsh_insert(hash, &lhq);
if (nxt_slow_path(ret != NXT_OK)) {
- njs_internal_error(vm, NULL);
+ njs_internal_error(vm, "lvlhsh insert failed");
return NULL;
}
}
@@ -229,7 +229,7 @@ njs_vm_external_bind(njs_vm_t *vm, const
ret = nxt_lvlhsh_insert(&vm->externals_hash, &lhq);
if (nxt_slow_path(ret != NXT_OK)) {
- njs_internal_error(vm, NULL);
+ njs_internal_error(vm, "lvlhsh insert failed");
return ret;
}
diff -r 7ccb11c88d27 -r 25d3bb391edb njs/njs_fs.c
--- a/njs/njs_fs.c Thu Aug 30 20:21:43 2018 +0300
+++ b/njs/njs_fs.c Fri Aug 31 16:55:35 2018 +0300
@@ -923,7 +923,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_internal_error(vm, NULL);
+ njs_internal_error(vm, "lvlhsh insert failed");
return NJS_ERROR;
}
}
@@ -942,7 +942,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_internal_error(vm, NULL);
+ njs_internal_error(vm, "lvlhsh insert failed");
return NJS_ERROR;
}
}
@@ -967,7 +967,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_internal_error(vm, NULL);
+ njs_internal_error(vm, "lvlhsh insert failed");
return NJS_ERROR;
}
}
diff -r 7ccb11c88d27 -r 25d3bb391edb njs/njs_generator.c
--- a/njs/njs_generator.c Thu Aug 30 20:21:43 2018 +0300
+++ b/njs/njs_generator.c Fri Aug 31 16:55:35 2018 +0300
@@ -2066,7 +2066,8 @@ njs_generate_scope(njs_vm_t *vm, njs_par
parser->code_size, code_size);
if (nxt_slow_path(parser->code_size < code_size)) {
- njs_internal_error(vm, NULL);
+ njs_internal_error(vm, "code size mismatch actual %uz < expected %uz",
+ parser->code_size, code_size);
return NXT_ERROR;
}
diff -r 7ccb11c88d27 -r 25d3bb391edb njs/njs_json.c
--- a/njs/njs_json.c Thu Aug 30 20:21:43 2018 +0300
+++ b/njs/njs_json.c Fri Aug 31 16:55:35 2018 +0300
@@ -474,7 +474,7 @@ njs_json_parse_object(njs_json_parse_ctx
ret = nxt_lvlhsh_insert(&object->hash, &lhq);
if (nxt_slow_path(ret != NXT_OK)) {
- njs_internal_error(ctx->vm, NULL);
+ njs_internal_error(ctx->vm, "lvlhsh insert/replace failed");
return NULL;
}
@@ -568,7 +568,6 @@ njs_json_parse_array(njs_json_parse_ctx_
ret = njs_array_add(ctx->vm, array, element);
if (nxt_slow_path(ret != NXT_OK)) {
- njs_internal_error(ctx->vm, NULL);
return NULL;
}
@@ -982,7 +981,7 @@ njs_json_parse_continuation(njs_vm_t *vm
}
if (nxt_slow_path(ret != NXT_OK)) {
- njs_internal_error(vm, NULL);
+ njs_internal_error(vm, "lvlhsh insert/replace failed");
return NXT_ERROR;
}
@@ -1020,7 +1019,8 @@ njs_json_parse_continuation(njs_vm_t *vm
break;
default:
- njs_internal_error(vm, NULL);
+ njs_internal_error(vm, "Unexpected state %d in JSON.parse()",
+ state->type);
return NXT_ERROR;
}
}
@@ -1062,7 +1062,8 @@ njs_json_parse_continuation_apply(njs_vm
break;
default:
- njs_internal_error(vm, NULL);
+ njs_internal_error(vm, "Unexpected state %d in JSON.parse() apply",
+ state->type);
return NXT_ERROR;
}
@@ -1489,7 +1490,8 @@ njs_json_stringify_to_json(njs_vm_t *vm,
break;
default:
- njs_internal_error(vm, NULL);
+ njs_internal_error(vm, "Unexpected state %d in JSON.stringify() apply",
+ state->type);
return NXT_ERROR;
}
@@ -1533,7 +1535,8 @@ njs_json_stringify_replacer(njs_vm_t *vm
break;
default:
- njs_internal_error(vm, NULL);
+ njs_internal_error(vm, "Unexpected state %d in "
+ "JSON.stringify() replacer", state->type);
return NXT_ERROR;
}
diff -r 7ccb11c88d27 -r 25d3bb391edb njs/njs_object.c
--- a/njs/njs_object.c Thu Aug 30 20:21:43 2018 +0300
+++ b/njs/njs_object.c Fri Aug 31 16:55:35 2018 +0300
@@ -117,7 +117,7 @@ njs_object_hash_create(njs_vm_t *vm, nxt
ret = nxt_lvlhsh_insert(hash, &lhq);
if (nxt_slow_path(ret != NXT_OK)) {
- njs_internal_error(vm, NULL);
+ njs_internal_error(vm, "lvlhsh insert failed");
return NXT_ERROR;
}
@@ -916,7 +916,7 @@ njs_define_property(njs_vm_t *vm, njs_ob
ret = nxt_lvlhsh_insert(&object->hash, &lhq);
if (nxt_slow_path(ret != NXT_OK)) {
- njs_internal_error(vm, NULL);
+ njs_internal_error(vm, "lvlhsh insert failed");
return NXT_ERROR;
}
@@ -1077,7 +1077,7 @@ njs_object_get_own_property_descriptor(n
ret = nxt_lvlhsh_insert(&descriptor->hash, &lhq);
if (nxt_slow_path(ret != NXT_OK)) {
- njs_internal_error(vm, NULL);
+ njs_internal_error(vm, "lvlhsh insert failed");
return NXT_ERROR;
}
@@ -1095,7 +1095,7 @@ njs_object_get_own_property_descriptor(n
ret = nxt_lvlhsh_insert(&descriptor->hash, &lhq);
if (nxt_slow_path(ret != NXT_OK)) {
- njs_internal_error(vm, NULL);
+ njs_internal_error(vm, "lvlhsh insert failed");
return NXT_ERROR;
}
@@ -1113,7 +1113,7 @@ njs_object_get_own_property_descriptor(n
ret = nxt_lvlhsh_insert(&descriptor->hash, &lhq);
if (nxt_slow_path(ret != NXT_OK)) {
- njs_internal_error(vm, NULL);
+ njs_internal_error(vm, "lvlhsh insert failed");
return NXT_ERROR;
}
@@ -1131,7 +1131,7 @@ njs_object_get_own_property_descriptor(n
ret = nxt_lvlhsh_insert(&descriptor->hash, &lhq);
if (nxt_slow_path(ret != NXT_OK)) {
- njs_internal_error(vm, NULL);
+ njs_internal_error(vm, "lvlhsh insert failed");
return NXT_ERROR;
}
@@ -1488,7 +1488,7 @@ njs_property_prototype_create(njs_vm_t *
return &prop->value;
}
- njs_internal_error(vm, NULL);
+ njs_internal_error(vm, "lvlhsh insert failed");
return NULL;
}
@@ -1730,7 +1730,7 @@ njs_property_constructor_create(njs_vm_t
return &prop->value;
}
- njs_internal_error(vm, NULL);
+ njs_internal_error(vm, "lvlhsh insert failed");
return NULL;
}
diff -r 7ccb11c88d27 -r 25d3bb391edb njs/njs_regexp.c
--- a/njs/njs_regexp.c Thu Aug 30 20:21:43 2018 +0300
+++ b/njs/njs_regexp.c Fri Aug 31 16:55:35 2018 +0300
@@ -327,7 +327,7 @@ njs_regexp_pattern_create(njs_vm_t *vm,
if (nxt_fast_path(ret >= 0)) {
if (nxt_slow_path((u_int) ret != pattern->ncaptures)) {
- njs_internal_error(vm, NULL);
+ njs_internal_error(vm, "regexp pattern compile failed");
nxt_mem_cache_free(vm->mem_cache_pool, pattern);
return NULL;
}
@@ -755,7 +755,7 @@ njs_regexp_exec_result(njs_vm_t *vm, njs
ret = nxt_lvlhsh_insert(&array->object.hash, &lhq);
if (nxt_slow_path(ret != NXT_OK)) {
- njs_internal_error(vm, NULL);
+ njs_internal_error(vm, "lvlhsh insert failed");
goto fail;
}
diff -r 7ccb11c88d27 -r 25d3bb391edb njs/njs_variable.c
--- a/njs/njs_variable.c Thu Aug 30 20:21:43 2018 +0300
+++ b/njs/njs_variable.c Fri Aug 31 16:55:35 2018 +0300
@@ -83,7 +83,7 @@ njs_builtin_add(njs_vm_t *vm, njs_parser
ret = nxt_lvlhsh_insert(&scope->variables, &lhq);
if (nxt_fast_path(ret == NXT_OK)) {
- njs_internal_error(vm, NULL);
+ njs_internal_error(vm, "lvlhsh insert failed");
return var;
}
More information about the nginx-devel
mailing list