From: Dmitry Volyntsev Date: Fri, 31 Aug 2018 13:55:35 +0000 (+0300) Subject: Improved wording for InternalError messages. X-Git-Tag: 0.2.4~10 X-Git-Url: http://www.kaiwu.me/postgresql/commit/?a=commitdiff_plain;h=3ef68402f8bcd54421b48d8fb4068514e8a750b1;p=njs.git Improved wording for InternalError messages. --- diff --git a/njs/njs_error.c b/njs/njs_error.c index 2cdc48e1..7b5e6c17 100644 --- a/njs/njs_error.c +++ b/njs/njs_error.c @@ -87,7 +87,7 @@ njs_error_alloc(njs_vm_t *vm, njs_value_type_t type, const njs_value_t *name, 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_type_t type, const njs_value_t *name, 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 --git a/njs/njs_extern.c b/njs/njs_extern.c index 07dcccdb..c87455bd 100644 --- a/njs/njs_extern.c +++ b/njs/njs_extern.c @@ -144,7 +144,7 @@ njs_vm_external_add(njs_vm_t *vm, nxt_lvlhsh_t *hash, njs_external_t *external, 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 nxt_str_t *var_name, 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 --git a/njs/njs_fs.c b/njs/njs_fs.c index 112f3db5..6e6c61cc 100644 --- a/njs/njs_fs.c +++ b/njs/njs_fs.c @@ -923,7 +923,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_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 *vm, const char *syscall, 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 *vm, const char *syscall, 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 --git a/njs/njs_generator.c b/njs/njs_generator.c index c35289fe..d33e987b 100644 --- a/njs/njs_generator.c +++ b/njs/njs_generator.c @@ -2066,7 +2066,8 @@ 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_internal_error(vm, NULL); + njs_internal_error(vm, "code size mismatch actual %uz < expected %uz", + parser->code_size, code_size); return NXT_ERROR; } diff --git a/njs/njs_json.c b/njs/njs_json.c index 3c33da87..f2f6fc4b 100644 --- a/njs/njs_json.c +++ b/njs/njs_json.c @@ -474,7 +474,7 @@ njs_json_parse_object(njs_json_parse_ctx_t *ctx, njs_value_t *value, 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_t *ctx, njs_value_t *value, 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, njs_value_t *args, nxt_uint_t nargs, } 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, njs_value_t *args, nxt_uint_t nargs, 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_t *vm, njs_json_parse_t *parse) 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, njs_json_stringify_t* stringify, 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, njs_json_stringify_t* stringify, break; default: - njs_internal_error(vm, NULL); + njs_internal_error(vm, "Unexpected state %d in " + "JSON.stringify() replacer", state->type); return NXT_ERROR; } diff --git a/njs/njs_object.c b/njs/njs_object.c index 2c108f25..45118f01 100644 --- a/njs/njs_object.c +++ b/njs/njs_object.c @@ -117,7 +117,7 @@ njs_object_hash_create(njs_vm_t *vm, nxt_lvlhsh_t *hash, 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_object_t *object, const njs_value_t *name, 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(njs_vm_t *vm, njs_value_t *args, 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(njs_vm_t *vm, njs_value_t *args, 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(njs_vm_t *vm, njs_value_t *args, 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(njs_vm_t *vm, njs_value_t *args, 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 *vm, nxt_lvlhsh_t *hash, 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 *vm, nxt_lvlhsh_t *hash, return &prop->value; } - njs_internal_error(vm, NULL); + njs_internal_error(vm, "lvlhsh insert failed"); return NULL; } diff --git a/njs/njs_regexp.c b/njs/njs_regexp.c index cf8068b5..8ac7c42e 100644 --- a/njs/njs_regexp.c +++ b/njs/njs_regexp.c @@ -327,7 +327,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_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_regexp_t *regexp, njs_utf8_t utf8, 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 --git a/njs/njs_variable.c b/njs/njs_variable.c index 569e8215..33ee2c74 100644 --- a/njs/njs_variable.c +++ b/njs/njs_variable.c @@ -83,7 +83,7 @@ njs_builtin_add(njs_vm_t *vm, njs_parser_t *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; }