From ba06d492a340bee7d82ff9595851cd278b7bd572 Mon Sep 17 00:00:00 2001 From: Zoltan Herczeg Date: Thu, 28 Jan 2021 12:10:13 +0100 Subject: [PATCH] Remove full stop after error messages (#4524) JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com --- jerry-core/api/jerry-snapshot.c | 30 +-- jerry-core/api/jerry.c | 116 ++++++--- jerry-core/ecma/base/ecma-globals.h | 2 +- jerry-core/ecma/base/ecma-helpers-string.c | 2 +- jerry-core/ecma/base/ecma-helpers-value.c | 3 +- jerry-core/ecma/base/ecma-module.c | 16 +- .../ecma-builtin-array-iterator-prototype.c | 6 +- .../ecma-builtin-array-prototype.c | 28 +- .../ecma/builtin-objects/ecma-builtin-array.c | 4 +- .../ecma-builtin-arraybuffer-prototype.c | 18 +- .../ecma-builtin-async-generator-prototype.c | 2 +- .../ecma-builtin-bigint-prototype.c | 4 +- .../builtin-objects/ecma-builtin-bigint.c | 2 +- .../ecma-builtin-boolean-prototype.c | 2 +- .../ecma-builtin-dataview-prototype.c | 4 +- .../builtin-objects/ecma-builtin-dataview.c | 2 +- .../ecma-builtin-date-prototype.c | 6 +- .../ecma-builtin-error-prototype.c | 2 +- .../ecma-builtin-function-prototype.c | 8 +- .../ecma-builtin-generator-prototype.c | 4 +- .../builtin-objects/ecma-builtin-global.c | 14 +- .../builtin-objects/ecma-builtin-helpers.c | 2 +- .../builtin-objects/ecma-builtin-intrinsic.c | 6 +- .../ecma/builtin-objects/ecma-builtin-json.c | 6 +- .../ecma/builtin-objects/ecma-builtin-map.c | 2 +- .../ecma-builtin-number-prototype.c | 10 +- .../ecma-builtin-object-prototype.c | 2 +- .../builtin-objects/ecma-builtin-object.c | 22 +- .../builtin-objects/ecma-builtin-promise.c | 10 +- .../builtin-objects/ecma-builtin-reflect.c | 12 +- .../ecma-builtin-regexp-prototype.c | 20 +- ...builtin-regexp-string-iterator-prototype.c | 4 +- .../builtin-objects/ecma-builtin-regexp.c | 2 +- .../ecma/builtin-objects/ecma-builtin-set.c | 2 +- .../ecma-builtin-string-iterator-prototype.c | 6 +- .../ecma-builtin-string-prototype.c | 6 +- .../builtin-objects/ecma-builtin-string.c | 2 +- .../builtin-objects/ecma-builtin-symbol.c | 4 +- .../builtin-objects/ecma-builtin-weakmap.c | 2 +- .../builtin-objects/ecma-builtin-weakset.c | 2 +- .../ecma/builtin-objects/ecma-builtins.c | 2 +- .../typedarray/ecma-builtin-bigint64array.c | 2 +- .../typedarray/ecma-builtin-biguint64array.c | 2 +- .../typedarray/ecma-builtin-float32array.c | 2 +- .../typedarray/ecma-builtin-float64array.c | 2 +- .../typedarray/ecma-builtin-int16array.c | 2 +- .../typedarray/ecma-builtin-int32array.c | 2 +- .../typedarray/ecma-builtin-int8array.c | 2 +- .../ecma-builtin-typedarray-prototype.c | 16 +- .../typedarray/ecma-builtin-typedarray.c | 12 +- .../typedarray/ecma-builtin-uint16array.c | 2 +- .../typedarray/ecma-builtin-uint32array.c | 2 +- .../typedarray/ecma-builtin-uint8array.c | 2 +- .../ecma-builtin-uint8clampedarray.c | 2 +- .../ecma/operations/ecma-array-object.c | 4 +- .../ecma/operations/ecma-arraybuffer-object.c | 2 +- .../operations/ecma-async-generator-object.c | 18 +- .../ecma/operations/ecma-container-object.c | 12 +- jerry-core/ecma/operations/ecma-conversion.c | 20 +- .../ecma/operations/ecma-dataview-object.c | 18 +- jerry-core/ecma/operations/ecma-eval.c | 2 +- .../ecma/operations/ecma-function-object.c | 36 +-- .../ecma/operations/ecma-get-put-value.c | 10 +- .../ecma/operations/ecma-iterator-object.c | 18 +- jerry-core/ecma/operations/ecma-lex-env.c | 8 +- .../ecma/operations/ecma-objects-general.c | 8 +- jerry-core/ecma/operations/ecma-objects.c | 8 +- .../ecma/operations/ecma-promise-object.c | 14 +- .../ecma/operations/ecma-proxy-object.c | 66 +++-- jerry-core/ecma/operations/ecma-reference.c | 2 +- .../ecma/operations/ecma-regexp-object.c | 26 +- .../ecma/operations/ecma-symbol-object.c | 2 +- .../ecma/operations/ecma-typedarray-object.c | 39 ++- jerry-core/parser/js/js-parser-util.c | 246 +++++++++--------- jerry-core/parser/js/js-parser.c | 2 +- jerry-core/parser/regexp/re-parser.c | 18 +- jerry-core/vm/opcodes-ecma-arithmetics.c | 2 +- .../vm/opcodes-ecma-relational-equality.c | 4 +- jerry-core/vm/opcodes.c | 10 +- jerry-core/vm/vm-stack.c | 4 +- jerry-core/vm/vm.c | 20 +- tests/unit-core/test-api.c | 6 +- 82 files changed, 551 insertions(+), 523 deletions(-) diff --git a/jerry-core/api/jerry-snapshot.c b/jerry-core/api/jerry-snapshot.c index f5d1f8fc6..7936237c0 100644 --- a/jerry-core/api/jerry-snapshot.c +++ b/jerry-core/api/jerry-snapshot.c @@ -144,7 +144,7 @@ snapshot_add_compiled_code (ecma_compiled_code_t *compiled_code_p, /**< compiled size_t snapshot_buffer_size, /**< snapshot buffer size */ snapshot_globals_t *globals_p) /**< snapshot globals */ { - const jerry_char_t *error_buffer_too_small_p = (const jerry_char_t *) "Snapshot buffer too small."; + const jerry_char_t *error_buffer_too_small_p = (const jerry_char_t *) "Snapshot buffer too small"; if (!ecma_is_value_empty (globals_p->snapshot_error)) { @@ -155,7 +155,7 @@ snapshot_add_compiled_code (ecma_compiled_code_t *compiled_code_p, /**< compiled if (globals_p->snapshot_buffer_write_offset > JERRY_SNAPSHOT_MAXIMUM_WRITE_OFFSET) { - const char * const error_message_p = "Maximum snapshot size reached."; + const char * const error_message_p = "Maximum snapshot size reached"; globals_p->snapshot_error = jerry_create_error (JERRY_ERROR_RANGE, (const jerry_char_t *) error_message_p); return 0; } @@ -170,7 +170,7 @@ snapshot_add_compiled_code (ecma_compiled_code_t *compiled_code_p, /**< compiled #if ENABLED (JERRY_ESNEXT) if (compiled_code_p->status_flags & CBC_CODE_FLAGS_HAS_TAGGED_LITERALS) { - const char * const error_message_p = "Unsupported feature: tagged template literals."; + const char * const error_message_p = "Unsupported feature: tagged template literals"; globals_p->snapshot_error = jerry_create_error (JERRY_ERROR_RANGE, (const jerry_char_t *) error_message_p); return 0; } @@ -340,7 +340,7 @@ static_snapshot_add_compiled_code (ecma_compiled_code_t *compiled_code_p, /**< c if (globals_p->snapshot_buffer_write_offset >= JERRY_SNAPSHOT_MAXIMUM_WRITE_OFFSET) { - const char * const error_message_p = "Maximum snapshot size reached."; + const char * const error_message_p = "Maximum snapshot size reached"; globals_p->snapshot_error = jerry_create_error (JERRY_ERROR_RANGE, (const jerry_char_t *) error_message_p); return 0; } @@ -355,7 +355,7 @@ static_snapshot_add_compiled_code (ecma_compiled_code_t *compiled_code_p, /**< c if (!CBC_IS_FUNCTION (compiled_code_p->status_flags)) { /* Regular expression literals are not supported. */ - const char * const error_message_p = "Regular expression literals are not supported."; + const char * const error_message_p = "Regular expression literals are not supported"; globals_p->snapshot_error = jerry_create_error (JERRY_ERROR_RANGE, (const jerry_char_t *) error_message_p); return 0; } @@ -366,7 +366,7 @@ static_snapshot_add_compiled_code (ecma_compiled_code_t *compiled_code_p, /**< c compiled_code_p, ((size_t) compiled_code_p->size) << JMEM_ALIGNMENT_LOG)) { - const char * const error_message_p = "Snapshot buffer too small."; + const char * const error_message_p = "Snapshot buffer too small"; globals_p->snapshot_error = jerry_create_error (JERRY_ERROR_RANGE, (const jerry_char_t *) error_message_p); return 0; } @@ -844,7 +844,7 @@ jerry_generate_snapshot_with_args (const jerry_char_t *resource_name_p, /**< scr &literals_num)) { JERRY_ASSERT (lit_map_p == NULL); - const char * const error_message_p = "Cannot allocate memory for literals."; + const char * const error_message_p = "Cannot allocate memory for literals"; ecma_bytecode_deref (bytecode_data_p); return jerry_create_error (JERRY_ERROR_COMMON, (const jerry_char_t *) error_message_p); } @@ -896,7 +896,7 @@ jerry_generate_snapshot (const jerry_char_t *resource_name_p, /**< script resour if ((generate_snapshot_opts & ~(allowed_opts)) != 0) { - const char * const error_message_p = "Unsupported generate snapshot flags specified."; + const char * const error_message_p = "Unsupported generate snapshot flags specified"; return jerry_create_error (JERRY_ERROR_RANGE, (const jerry_char_t *) error_message_p); } @@ -918,7 +918,7 @@ jerry_generate_snapshot (const jerry_char_t *resource_name_p, /**< script resour JERRY_UNUSED (buffer_p); JERRY_UNUSED (buffer_size); - return jerry_create_error (JERRY_ERROR_COMMON, (const jerry_char_t *) "Snapshot save is not supported."); + return jerry_create_error (JERRY_ERROR_COMMON, (const jerry_char_t *) "Snapshot save is not supported"); #endif /* ENABLED (JERRY_SNAPSHOT_SAVE) */ } /* jerry_generate_snapshot */ @@ -945,7 +945,7 @@ jerry_snapshot_result (const uint32_t *snapshot_p, /**< snapshot */ if ((exec_snapshot_opts & ~(allowed_opts)) != 0) { - ecma_raise_range_error (ECMA_ERR_MSG ("Unsupported exec snapshot flags specified.")); + ecma_raise_range_error (ECMA_ERR_MSG ("Unsupported snapshot exec flags are specified")); return ecma_create_error_reference_from_context (); } @@ -990,7 +990,7 @@ jerry_snapshot_result (const uint32_t *snapshot_p, /**< snapshot */ { if (!(exec_snapshot_opts & JERRY_SNAPSHOT_EXEC_ALLOW_STATIC)) { - ecma_raise_common_error (ECMA_ERR_MSG ("Static snapshots not allowed")); + ecma_raise_common_error (ECMA_ERR_MSG ("Static snapshots are not enabled")); return ecma_create_error_reference_from_context (); } @@ -1088,7 +1088,7 @@ jerry_exec_snapshot (const uint32_t *snapshot_p, /**< snapshot */ JERRY_UNUSED (func_index); JERRY_UNUSED (exec_snapshot_opts); - return jerry_create_error (JERRY_ERROR_COMMON, (const jerry_char_t *) "Snapshot execution is not supported."); + return jerry_create_error (JERRY_ERROR_COMMON, (const jerry_char_t *) "Snapshot execution is not supported"); #endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */ } /* jerry_exec_snapshot */ @@ -1821,7 +1821,7 @@ jerry_generate_function_snapshot (const jerry_char_t *resource_name_p, /**< scri if ((generate_snapshot_opts & ~(allowed_opts)) != 0) { - const char * const error_message_p = "Unsupported generate snapshot flags specified."; + const char * const error_message_p = "Unsupported generate snapshot flags specified"; return jerry_create_error (JERRY_ERROR_RANGE, (const jerry_char_t *) error_message_p); } @@ -1845,7 +1845,7 @@ jerry_generate_function_snapshot (const jerry_char_t *resource_name_p, /**< scri JERRY_UNUSED (buffer_p); JERRY_UNUSED (buffer_size); - return jerry_create_error (JERRY_ERROR_COMMON, (const jerry_char_t *) "Snapshot save is not supported."); + return jerry_create_error (JERRY_ERROR_COMMON, (const jerry_char_t *) "Snapshot save is not supported"); #endif /* ENABLED (JERRY_SNAPSHOT_SAVE) */ } /* jerry_generate_function_snapshot */ @@ -1872,6 +1872,6 @@ jerry_load_function_snapshot (const uint32_t *function_snapshot_p, /**< snapshot JERRY_UNUSED (func_index); JERRY_UNUSED (exec_snapshot_opts); - return jerry_create_error (JERRY_ERROR_COMMON, (const jerry_char_t *) "Snapshot execution is not supported."); + return jerry_create_error (JERRY_ERROR_COMMON, (const jerry_char_t *) "Snapshot execution is not supported"); #endif /* ENABLED (JERRY_SNAPSHOT_EXEC) */ } /* jerry_load_function_snapshot */ diff --git a/jerry-core/api/jerry.c b/jerry-core/api/jerry.c index fef9a2ff3..8de0070bc 100644 --- a/jerry-core/api/jerry.c +++ b/jerry-core/api/jerry.c @@ -106,20 +106,60 @@ JERRY_STATIC_ASSERT (((NUMBER_ARITHMETIC_SUBTRACTION + ECMA_NUMBER_ARITHMETIC_OP /** * Error message, if an argument is has an error flag */ -static const char * const error_value_msg_p = "argument cannot have an error flag"; +static const char * const error_value_msg_p = "Argument cannot be marked as error"; /** - * Error message, if types of arguments are incorrect + * Error message, if an argument has a wrong type */ -static const char * const wrong_args_msg_p = "wrong type of argument"; +static const char * const wrong_args_msg_p = "This type of argument is not allowed"; + +#if !ENABLED (JERRY_PARSER) +/** + * Error message, if parsing is disabled + */ +static const char * const error_parser_not_supported_p = "Source code parsing is disabled"; +#endif /* !ENABLED (JERRY_PARSER) */ + +#if !ENABLED (JERRY_BUILTIN_JSON) +/** + * Error message, if JSON support is disabled + */ +static const char * const error_json_not_supported_p = "JSON support is disabled"; +#endif /* !ENABLED (JERRY_BUILTIN_JSON) */ + +#if !ENABLED (JERRY_ESNEXT) +/** + * Error message, if Symbol support is disabled + */ +static const char * const error_symbol_not_supported_p = "Symbol support is disabled"; +#endif /* !ENABLED (JERRY_ESNEXT) */ + +#if !ENABLED (JERRY_BUILTIN_PROMISE) +/** + * Error message, if Promise support is disabled + */ +static const char * const error_promise_not_supported_p = "Promise support is disabled"; +#endif /* !ENABLED (JERRY_BUILTIN_PROMISE) */ + +#if !ENABLED (JERRY_BUILTIN_TYPEDARRAY) +/** + * Error message, if TypedArray support is disabled + */ +static const char * const error_typed_array_not_supported_p = "TypedArray support is disabled"; +#endif /* !ENABLED (JERRY_BUILTIN_TYPEDARRAY) */ + +#if !ENABLED (JERRY_BUILTIN_DATAVIEW) +/** + * Error message, if DataView support is disabled + */ +static const char * const error_data_view_not_supported_p = "DataView support is disabled"; +#endif /* !ENABLED (JERRY_BUILTIN_DATAVIEW) */ #if !ENABLED (JERRY_BUILTIN_BIGINT) - /** * Error message, if BigInt support is disabled */ static const char * const error_bigint_not_supported_p = "BigInt support is disabled"; - #endif /* !ENABLED (JERRY_BUILTIN_BIGINT) */ #endif /* ENABLED (JERRY_ERROR_MESSAGES) */ @@ -457,7 +497,7 @@ jerry_parse (const jerry_char_t *resource_name_p, /**< resource name (usually a #if ENABLED (JERRY_MODULE_SYSTEM) ecma_module_initialize_context (ecma_get_string_from_value (resource_name)); #else /* !ENABLED (JERRY_MODULE_SYSTEM) */ - return jerry_throw (ecma_raise_syntax_error (ECMA_ERR_MSG ("Module system has been disabled."))); + return jerry_throw (ecma_raise_syntax_error (ECMA_ERR_MSG ("Module system has been disabled"))); #endif /* !ENABLED (JERRY_MODULE_SYSTEM) */ } @@ -527,7 +567,7 @@ jerry_parse (const jerry_char_t *resource_name_p, /**< resource name (usually a JERRY_UNUSED (source_size); JERRY_UNUSED (parse_opts); - return jerry_throw (ecma_raise_syntax_error (ECMA_ERR_MSG ("The parser has been disabled."))); + return jerry_throw (ecma_raise_syntax_error (ECMA_ERR_MSG (error_parser_not_supported_p))); #endif /* ENABLED (JERRY_PARSER) */ } /* jerry_parse */ @@ -608,7 +648,7 @@ jerry_parse_function (const jerry_char_t *resource_name_p, /**< resource name (u JERRY_UNUSED (source_size); JERRY_UNUSED (parse_opts); - return jerry_throw (ecma_raise_syntax_error (ECMA_ERR_MSG ("The parser has been disabled."))); + return jerry_throw (ecma_raise_syntax_error (ECMA_ERR_MSG (error_parser_not_supported_p))); #endif /* ENABLED (JERRY_PARSER) */ } /* jerry_parse_function */ @@ -2156,7 +2196,7 @@ jerry_create_promise (void) JERRY_CONTEXT (current_new_target_p) = old_new_target_p; return promise_value; #else /* !ENABLED (JERRY_BUILTIN_PROMISE) */ - return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("Promise not supported."))); + return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_promise_not_supported_p))); #endif /* ENABLED (JERRY_BUILTIN_PROMISE) */ } /* jerry_create_promise */ @@ -2184,7 +2224,7 @@ jerry_create_proxy (const jerry_value_t target, /**< target argument */ ecma_object_t *proxy_p = ecma_proxy_create (target, handler); return jerry_return (proxy_p == NULL ? ECMA_VALUE_ERROR : ecma_make_object_value (proxy_p)); #else /* !ENABLED (JERRY_BUILTIN_PROXY) */ - return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("Proxy is not supported."))); + return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("Proxy is not supported"))); #endif /* ENABLED (JERRY_BUILTIN_PROXY) */ } /* jerry_create_proxy */ @@ -2314,7 +2354,7 @@ jerry_create_symbol (const jerry_value_t value) /**< api value */ #if ENABLED (JERRY_ESNEXT) return jerry_return (ecma_op_create_symbol (&value, 1)); #else /* !ENABLED (JERRY_ESNEXT) */ - return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("Symbol is not supported."))); + return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_symbol_not_supported_p))); #endif /* ENABLED (JERRY_ESNEXT) */ } /* jerry_create_symbol */ @@ -2392,7 +2432,7 @@ jerry_create_regexp_sz (const jerry_char_t *pattern_p, /**< zero-terminated UTF- JERRY_UNUSED (pattern_size); JERRY_UNUSED (flags); - return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("RegExp is not supported."))); + return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("RegExp is not supported"))); #endif /* ENABLED (JERRY_BUILTIN_REGEXP) */ } /* jerry_create_regexp_sz */ @@ -2410,7 +2450,7 @@ jerry_create_realm (void) ecma_global_object_t *global_object_p = ecma_builtin_create_global_object (); return ecma_make_object_value ((ecma_object_t *) global_object_p); #else /* !ENABLED (JERRY_BUILTIN_REALMS) */ - return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("Realms are disabled."))); + return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("Realms are disabled"))); #endif /* ENABLED (JERRY_BUILTIN_REALMS) */ } /* jerry_create_realm */ @@ -4205,7 +4245,7 @@ jerry_resolve_or_reject_promise (jerry_value_t promise, /**< the promise value * JERRY_UNUSED (argument); JERRY_UNUSED (is_resolve); - return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("Promise not supported."))); + return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_promise_not_supported_p))); #endif /* ENABLED (JERRY_BUILTIN_PROMISE) */ } /* jerry_resolve_or_reject_promise */ @@ -4229,7 +4269,7 @@ jerry_get_promise_result (const jerry_value_t promise) /**< promise object to ge return ecma_promise_get_result (ecma_get_object_from_value (promise)); #else /* !ENABLED (JERRY_BUILTIN_PROMISE) */ JERRY_UNUSED (promise); - return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("Promise not supported."))); + return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_promise_not_supported_p))); #endif /* ENABLED (JERRY_BUILTIN_PROMISE) */ } /* jerry_get_promise_result */ @@ -4316,7 +4356,7 @@ jerry_get_symbol_description (const jerry_value_t symbol) /**< symbol value */ #else /* !ENABLED (JERRY_ESNEXT) */ JERRY_UNUSED (symbol); - return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("Symbol is not supported."))); + return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_symbol_not_supported_p))); #endif /* ENABLED (JERRY_ESNEXT) */ } /* jerry_get_symbol_description */ @@ -4345,7 +4385,7 @@ jerry_get_symbol_descriptive_string (const jerry_value_t symbol) /**< symbol val #else /* !ENABLED (JERRY_ESNEXT) */ JERRY_UNUSED (symbol); - return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("Symbol is not supported."))); + return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_symbol_not_supported_p))); #endif /* ENABLED (JERRY_ESNEXT) */ } /** jerry_get_symbol_descriptive_string */ @@ -4880,7 +4920,7 @@ jerry_create_arraybuffer (const jerry_length_t size) /**< size of the ArrayBuffe return jerry_return (ecma_make_object_value (ecma_arraybuffer_new_object (size))); #else /* !ENABLED (JERRY_BUILTIN_TYPEDARRAY) */ JERRY_UNUSED (size); - return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer not supported."))); + return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_typed_array_not_supported_p))); #endif /* ENABLED (JERRY_BUILTIN_TYPEDARRAY) */ } /* jerry_create_arraybuffer */ @@ -4921,7 +4961,7 @@ jerry_create_arraybuffer_external (const jerry_length_t size, /**< size of the b JERRY_UNUSED (size); JERRY_UNUSED (buffer_p); JERRY_UNUSED (free_cb); - return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer not supported."))); + return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_typed_array_not_supported_p))); #endif /* ENABLED (JERRY_BUILTIN_TYPEDARRAY) */ } /* jerry_create_arraybuffer_external */ @@ -5127,7 +5167,7 @@ jerry_detach_arraybuffer (const jerry_value_t value) /**< ArrayBuffer */ { return ECMA_VALUE_NULL; } - return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has already been detached."))); + return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has already been detached"))); } #else /* !ENABLED (JERRY_BUILTIN_TYPEDARRAY) */ JERRY_UNUSED (value); @@ -5181,8 +5221,8 @@ jerry_create_dataview (const jerry_value_t array_buffer, /**< arraybuffer to cre JERRY_UNUSED (array_buffer); JERRY_UNUSED (byte_offset); JERRY_UNUSED (byte_length); - return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("DataView is not supported."))); -#endif /* ENABLED (JERRY_BUILTIN_DATAVIEW */ + return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_data_view_not_supported_p))); +#endif /* ENABLED (JERRY_BUILTIN_DATAVIEW) */ } /* jerry_create_dataview */ /** @@ -5201,7 +5241,7 @@ jerry_value_is_dataview (const jerry_value_t value) /**< value to check if it is #else /* !ENABLED (JERRY_BUILTIN_DATAVIEW) */ JERRY_UNUSED (value); return false; -#endif /* ENABLED (JERRY_BUILTIN_DATAVIEW */ +#endif /* ENABLED (JERRY_BUILTIN_DATAVIEW) */ } /* jerry_value_is_dataview */ /** @@ -5254,8 +5294,8 @@ jerry_get_dataview_buffer (const jerry_value_t value, /**< DataView to get the a JERRY_UNUSED (value); JERRY_UNUSED (byte_offset); JERRY_UNUSED (byte_length); - return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("DataView is not supported."))); -#endif /* ENABLED (JERRY_BUILTIN_DATAVIEW */ + return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_data_view_not_supported_p))); +#endif /* ENABLED (JERRY_BUILTIN_DATAVIEW) */ } /* jerry_get_dataview_buffer */ /** @@ -5376,7 +5416,7 @@ jerry_create_typedarray (jerry_typedarray_type_t type_name, /**< type of TypedAr if (!jerry_typedarray_find_by_type (type_name, &prototype_id, &id, &element_size_shift)) { - return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("incorrect type for TypedArray."))); + return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("Incorrect type for TypedArray"))); } ecma_object_t *prototype_obj_p = ecma_builtin_get (prototype_id); @@ -5393,7 +5433,7 @@ jerry_create_typedarray (jerry_typedarray_type_t type_name, /**< type of TypedAr #else /* !ENABLED (JERRY_BUILTIN_TYPEDARRAY) */ JERRY_UNUSED (type_name); JERRY_UNUSED (length); - return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("TypedArray not supported."))); + return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_typed_array_not_supported_p))); #endif /* ENABLED (JERRY_BUILTIN_TYPEDARRAY) */ } /* jerry_create_typedarray */ @@ -5426,7 +5466,7 @@ jerry_create_typedarray_for_arraybuffer_sz (jerry_typedarray_type_t type_name, / if (!jerry_typedarray_find_by_type (type_name, &prototype_id, &id, &element_size_shift)) { - return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("incorrect type for TypedArray."))); + return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("Incorrect type for TypedArray"))); } if (!ecma_is_arraybuffer (arraybuffer)) @@ -5452,7 +5492,7 @@ jerry_create_typedarray_for_arraybuffer_sz (jerry_typedarray_type_t type_name, / JERRY_UNUSED (arraybuffer); JERRY_UNUSED (byte_offset); JERRY_UNUSED (length); - return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("TypedArray not supported."))); + return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_typed_array_not_supported_p))); #endif /* ENABLED (JERRY_BUILTIN_TYPEDARRAY) */ } /* jerry_create_typedarray_for_arraybuffer_sz */ @@ -5482,7 +5522,7 @@ jerry_create_typedarray_for_arraybuffer (jerry_typedarray_type_t type_name, /**< #else /* !ENABLED (JERRY_BUILTIN_TYPEDARRAY) */ JERRY_UNUSED (type_name); JERRY_UNUSED (arraybuffer); - return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("TypedArray not supported."))); + return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_typed_array_not_supported_p))); #endif /* ENABLED (JERRY_BUILTIN_TYPEDARRAY) */ } /* jerry_create_typedarray_for_arraybuffer */ @@ -5565,7 +5605,7 @@ jerry_get_typedarray_buffer (jerry_value_t value, /**< TypedArray to get the arr #if ENABLED (JERRY_BUILTIN_TYPEDARRAY) if (!ecma_is_typedarray (value)) { - return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("Object is not a TypedArray."))); + return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("Object is not a TypedArray"))); } ecma_object_t *array_p = ecma_get_object_from_value (value); @@ -5588,7 +5628,7 @@ jerry_get_typedarray_buffer (jerry_value_t value, /**< TypedArray to get the arr JERRY_UNUSED (value); JERRY_UNUSED (byte_length); JERRY_UNUSED (byte_offset); - return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("TypedArray is not supported."))); + return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_typed_array_not_supported_p))); #endif /* ENABLED (JERRY_BUILTIN_TYPEDARRAY) */ } /* jerry_get_typedarray_buffer */ @@ -5614,7 +5654,7 @@ jerry_json_parse (const jerry_char_t *string_p, /**< json string */ if (ecma_is_value_undefined (ret_value)) { - ret_value = jerry_throw (ecma_raise_syntax_error (ECMA_ERR_MSG ("JSON string parse error."))); + ret_value = jerry_throw (ecma_raise_syntax_error (ECMA_ERR_MSG ("JSON string parse error"))); } return jerry_return (ret_value); @@ -5622,7 +5662,7 @@ jerry_json_parse (const jerry_char_t *string_p, /**< json string */ JERRY_UNUSED (string_p); JERRY_UNUSED (string_size); - return jerry_throw (ecma_raise_syntax_error (ECMA_ERR_MSG ("The JSON has been disabled."))); + return jerry_throw (ecma_raise_syntax_error (ECMA_ERR_MSG (error_json_not_supported_p))); #endif /* ENABLED (JERRY_BUILTIN_JSON) */ } /* jerry_json_parse */ @@ -5651,14 +5691,14 @@ jerry_json_stringify (const jerry_value_t input_value) /**< a value to stringify if (ecma_is_value_undefined (ret_value)) { - ret_value = jerry_throw (ecma_raise_syntax_error (ECMA_ERR_MSG ("JSON stringify error."))); + ret_value = jerry_throw (ecma_raise_syntax_error (ECMA_ERR_MSG ("JSON stringify error"))); } return jerry_return (ret_value); #else /* ENABLED (JERRY_BUILTIN_JSON) */ JERRY_UNUSED (input_value); - return jerry_throw (ecma_raise_syntax_error (ECMA_ERR_MSG ("The JSON has been disabled."))); + return jerry_throw (ecma_raise_syntax_error (ECMA_ERR_MSG (error_json_not_supported_p))); #endif /* ENABLED (JERRY_BUILTIN_JSON) */ } /* jerry_json_stringify */ @@ -5731,7 +5771,7 @@ jerry_create_container (jerry_container_type_t container_type, /**< Type of the #endif /* ENABLED (JERRY_BUILTIN_WEAKSET) */ default: { - return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("Invalid container type."))); + return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("Invalid container type"))); } } ecma_object_t * old_new_target_p = JERRY_CONTEXT (current_new_target_p); @@ -5752,7 +5792,7 @@ jerry_create_container (jerry_container_type_t container_type, /**< Type of the JERRY_UNUSED (arguments_list_p); JERRY_UNUSED (arguments_list_len); JERRY_UNUSED (container_type); - return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("Containers are disabled."))); + return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("Containers are disabled"))); #endif /* ENABLED (JERRY_BUILTIN_CONTAINER) */ } /* jerry_create_container */ diff --git a/jerry-core/ecma/base/ecma-globals.h b/jerry-core/ecma/base/ecma-globals.h index 3af2d78c7..8b8d20984 100644 --- a/jerry-core/ecma/base/ecma-globals.h +++ b/jerry-core/ecma/base/ecma-globals.h @@ -2134,7 +2134,7 @@ do \ { \ if (ecma_get_current_stack_usage () > CONFIG_MEM_STACK_LIMIT) \ { \ - return ecma_raise_range_error (ECMA_ERR_MSG ("Maximum call stack size exceeded.")); \ + return ecma_raise_range_error (ECMA_ERR_MSG ("Maximum call stack size exceeded")); \ } \ } while (0) #else /* JERRY_STACK_LIMIT == 0) */ diff --git a/jerry-core/ecma/base/ecma-helpers-string.c b/jerry-core/ecma/base/ecma-helpers-string.c index f11aad239..8e3240ee0 100644 --- a/jerry-core/ecma/base/ecma-helpers-string.c +++ b/jerry-core/ecma/base/ecma-helpers-string.c @@ -2603,7 +2603,7 @@ ecma_string_pad (ecma_value_t original_string_p, /**< Input ecma string */ if (int_max_length >= UINT32_MAX) { ecma_deref_ecma_string (filler_p); - return ecma_raise_range_error (ECMA_ERR_MSG ("Maximum string length is reached.")); + return ecma_raise_range_error (ECMA_ERR_MSG ("Maximum string length is reached")); } /* 9 */ diff --git a/jerry-core/ecma/base/ecma-helpers-value.c b/jerry-core/ecma/base/ecma-helpers-value.c index 23bbd43f9..8107b742f 100644 --- a/jerry-core/ecma/base/ecma-helpers-value.c +++ b/jerry-core/ecma/base/ecma-helpers-value.c @@ -479,8 +479,7 @@ ecma_is_value_array (ecma_value_t arg) /**< argument */ if (proxy_obj_p->handler == ECMA_VALUE_NULL) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Cannot perform 'IsArray' on the given proxy " - "because handler is null")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Proxy handler is null for 'isArray' operation")); } return ecma_is_value_array (proxy_obj_p->target); diff --git a/jerry-core/ecma/base/ecma-module.c b/jerry-core/ecma/base/ecma-module.c index 641649c34..a1ce11455 100644 --- a/jerry-core/ecma/base/ecma-module.c +++ b/jerry-core/ecma/base/ecma-module.c @@ -398,7 +398,7 @@ ecma_module_resolve_export (ecma_module_t *const module_p, /**< base module */ if (ecma_compare_ecma_string_to_magic_id (current_export_name_p, LIT_MAGIC_STRING_DEFAULT)) { - ret_value = ecma_raise_syntax_error (ECMA_ERR_MSG ("No default export in native module.")); + ret_value = ecma_raise_syntax_error (ECMA_ERR_MSG ("No default export in native module")); break; } @@ -480,7 +480,7 @@ ecma_module_resolve_export (ecma_module_t *const module_p, /**< base module */ /* 15.2.1.16.3 / 6 */ if (ecma_compare_ecma_string_to_magic_id (current_export_name_p, LIT_MAGIC_STRING_DEFAULT)) { - ret_value = ecma_raise_syntax_error (ECMA_ERR_MSG ("No explicitly defined default export in module.")); + ret_value = ecma_raise_syntax_error (ECMA_ERR_MSG ("No explicitly defined default export in module")); break; } @@ -529,7 +529,7 @@ ecma_module_resolve_export (ecma_module_t *const module_p, /**< base module */ } else { - ret_value = ecma_raise_syntax_error (ECMA_ERR_MSG ("Unexported or circular import request.")); + ret_value = ecma_raise_syntax_error (ECMA_ERR_MSG ("Unexported or circular import request")); } return ret_value; @@ -766,7 +766,7 @@ ecma_module_connect_imports (ecma_module_t *module_p) if (binding_p != NULL) { - return ecma_raise_syntax_error (ECMA_ERR_MSG ("Imported binding shadows local variable.")); + return ecma_raise_syntax_error (ECMA_ERR_MSG ("Imported binding shadows local variable")); } ecma_value_t status = ecma_op_has_binding (lex_env_p, import_names_p->local_name_p); @@ -780,7 +780,7 @@ ecma_module_connect_imports (ecma_module_t *module_p) if (ecma_is_value_true (status)) { - return ecma_raise_syntax_error (ECMA_ERR_MSG ("Imported binding shadows local variable.")); + return ecma_raise_syntax_error (ECMA_ERR_MSG ("Imported binding shadows local variable")); } import_names_p = import_names_p->next_p; @@ -831,7 +831,7 @@ ecma_module_connect_imports (ecma_module_t *module_p) if (record.module_p == NULL) { - return ecma_raise_syntax_error (ECMA_ERR_MSG ("Ambiguous import request.")); + return ecma_raise_syntax_error (ECMA_ERR_MSG ("Ambiguous import request")); } if (record.module_p->state == ECMA_MODULE_STATE_NATIVE) @@ -916,7 +916,7 @@ ecma_module_check_indirect_exports (ecma_module_t *module_p) if (record.module_p == NULL) { - return ecma_raise_syntax_error (ECMA_ERR_MSG ("Ambiguous indirect export request.")); + return ecma_raise_syntax_error (ECMA_ERR_MSG ("Ambiguous indirect export request")); } name_p = name_p->next_p; @@ -1004,7 +1004,7 @@ ecma_module_parse (ecma_module_t *module_p) /**< module */ if (source_p == NULL) { - return ecma_raise_syntax_error (ECMA_ERR_MSG ("File not found.")); + return ecma_raise_syntax_error (ECMA_ERR_MSG ("File not found")); } ecma_module_t *prev_module_p = JERRY_CONTEXT (module_current_p); diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-array-iterator-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-array-iterator-prototype.c index a6203a1c4..81b3643e6 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-array-iterator-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-array-iterator-prototype.c @@ -56,7 +56,7 @@ ecma_builtin_array_iterator_prototype_object_next (ecma_value_t this_val) /**< t /* 1 - 2. */ if (!ecma_is_value_object (this_val)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object")); } ecma_object_t *obj_p = ecma_get_object_from_value (this_val); @@ -66,7 +66,7 @@ ecma_builtin_array_iterator_prototype_object_next (ecma_value_t this_val) /**< t if (ecma_get_object_type (obj_p) != ECMA_OBJECT_TYPE_PSEUDO_ARRAY || ext_obj_p->u.pseudo_array.type != ECMA_PSEUDO_ARRAY_ITERATOR) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an iterator.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an iterator")); } ecma_value_t iterated_value = ext_obj_p->u.pseudo_array.u2.iterated_value; @@ -87,7 +87,7 @@ ecma_builtin_array_iterator_prototype_object_next (ecma_value_t this_val) /**< t ecma_object_t *arraybuffer_p = ecma_typedarray_get_arraybuffer (array_object_p); if (ecma_arraybuffer_is_detached (arraybuffer_p)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached")); } /* b. */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.c index d77173a88..eaa51e2d7 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.c @@ -393,7 +393,7 @@ ecma_builtin_array_prototype_object_pop (ecma_object_t *obj_p, /**< object */ if (!ecma_op_ordinary_object_is_extensible (obj_p)) { ecma_free_value (get_value); - return ecma_raise_type_error (ECMA_ERR_MSG ("Invalid argument type.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Invalid argument type")); } ecma_delete_fast_array_properties (obj_p, (uint32_t) len); @@ -443,12 +443,12 @@ ecma_builtin_array_prototype_object_push (const ecma_value_t *argument_list_p, / { if (!ecma_op_ordinary_object_is_extensible (obj_p)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Invalid argument type.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Invalid argument type")); } if ((ecma_number_t) (length + arguments_number) > UINT32_MAX) { - return ecma_raise_range_error (ECMA_ERR_MSG ("Invalid array length")); + return ecma_raise_range_error (ECMA_ERR_MSG ("Invalid Array length")); } if (arguments_number == 0) @@ -1109,7 +1109,7 @@ ecma_builtin_array_prototype_object_sort (ecma_value_t this_arg, /**< this argum /* Check if the provided compare function is callable. */ if (!ecma_is_value_undefined (arg1) && !ecma_op_is_callable (arg1)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Compare function is not callable.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Compare function is not callable")); } ecma_length_t len; @@ -1308,7 +1308,7 @@ ecma_builtin_array_prototype_object_splice (const ecma_value_t args[], /**< argu /* ES11: 8. */ if ((ecma_number_t) new_length > ECMA_NUMBER_MAX_SAFE_INTEGER) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Invalid new array length")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Invalid new Array length")); } /* ES11: 9. */ @@ -1519,7 +1519,7 @@ ecma_builtin_array_prototype_object_unshift (const ecma_value_t args[], /**< arg { if (args_number > UINT32_MAX - len) { - return ecma_raise_range_error (ECMA_ERR_MSG ("Invalid array length")); + return ecma_raise_range_error (ECMA_ERR_MSG ("Invalid Array length")); } if (args_number == 0) @@ -1863,7 +1863,7 @@ ecma_builtin_array_apply (ecma_value_t arg1, /**< callbackfn */ /* 4. */ if (!ecma_op_is_callable (arg1)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Callback function is not callable.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Callback function is not callable")); } /* We already checked that arg1 is callable */ @@ -1946,7 +1946,7 @@ ecma_builtin_array_prototype_object_map (ecma_value_t arg1, /**< callbackfn */ /* 4. */ if (!ecma_op_is_callable (arg1)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Callback function is not callable.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Callback function is not callable")); } /* 6. */ @@ -2040,7 +2040,7 @@ ecma_builtin_array_prototype_object_filter (ecma_value_t arg1, /**< callbackfn * /* 4. */ if (!ecma_op_is_callable (arg1)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Callback function is not callable.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Callback function is not callable")); } /* 6. */ @@ -2148,13 +2148,13 @@ ecma_builtin_array_reduce_from (const ecma_value_t args_p[], /**< routine's argu /* 4. */ if (!ecma_op_is_callable (args_p[0])) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Callback function is not callable.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Callback function is not callable")); } /* 5. */ if (len == 0 && args_number == 1) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Reduce of empty array with no initial value.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Reduce of empty Array with no initial value")); } JERRY_ASSERT (ecma_is_value_object (args_p[0])); @@ -2207,7 +2207,7 @@ ecma_builtin_array_reduce_from (const ecma_value_t args_p[], /**< routine's argu /* 8.c */ if (!k_present) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Missing array element.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Missing Array element")); } } /* 9. */ @@ -2367,7 +2367,7 @@ ecma_builtin_array_prototype_object_find (ecma_value_t predicate, /**< callback /* 5. */ if (!ecma_op_is_callable (predicate)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Callback function is not callable.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Callback function is not callable")); } /* We already checked that predicate is callable, so it will always be an object. */ @@ -2851,7 +2851,7 @@ ecma_builtin_array_prototype_object_flat_map (ecma_value_t callback, /**< callba { if (!ecma_op_is_callable (callback)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Callback function is not callable.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Callback function is not callable")); } /* 4. */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-array.c b/jerry-core/ecma/builtin-objects/ecma-builtin-array.c index 40bc30e23..e9deae663 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-array.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-array.c @@ -96,7 +96,7 @@ ecma_builtin_array_object_from (ecma_value_t this_arg, /**< 'this' argument */ /* 3.a */ if (!ecma_op_is_callable (mapfn)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Callback function is not callable.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Callback function is not callable")); } /* 3.b */ @@ -493,7 +493,7 @@ ecma_builtin_array_dispatch_call (const ecma_value_t *arguments_list_p, /**< arg if (num != ((ecma_number_t) num_uint32)) { - return ecma_raise_range_error (ECMA_ERR_MSG ("Invalid array length.")); + return ecma_raise_range_error (ECMA_ERR_MSG ("Invalid array length")); } return ecma_make_object_value (ecma_op_new_array_object (num_uint32)); diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.c index a6038cc3e..760fdcea7 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.c @@ -65,7 +65,7 @@ ecma_builtin_arraybuffer_prototype_bytelength_getter (ecma_value_t this_arg) /** { if (ecma_arraybuffer_is_detached (object_p)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached")); } uint32_t len = ecma_arraybuffer_get_length (object_p); @@ -73,7 +73,7 @@ ecma_builtin_arraybuffer_prototype_bytelength_getter (ecma_value_t this_arg) /** } } - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a ArrayBuffer object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a ArrayBuffer object")); } /* ecma_builtin_arraybuffer_prototype_bytelength_getter */ /** @@ -92,7 +92,7 @@ ecma_builtin_arraybuffer_prototype_object_slice (ecma_value_t this_arg, /**< thi { if (!ecma_is_value_object (this_arg)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object")); } ecma_object_t *object_p = ecma_get_object_from_value (this_arg); @@ -100,7 +100,7 @@ ecma_builtin_arraybuffer_prototype_object_slice (ecma_value_t this_arg, /**< thi /* 2. */ if (!ecma_object_class_is (object_p, LIT_MAGIC_STRING_ARRAY_BUFFER_UL)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an ArrayBuffer object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an ArrayBuffer object")); } /* TODO: step 3. if SharedArrayBuffer will be implemented */ @@ -108,7 +108,7 @@ ecma_builtin_arraybuffer_prototype_object_slice (ecma_value_t this_arg, /**< thi /* 4. */ if (ecma_arraybuffer_is_detached (object_p)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached")); } /* 5. */ @@ -170,7 +170,7 @@ ecma_builtin_arraybuffer_prototype_object_slice (ecma_value_t this_arg, /**< thi /* 13. */ if (!ecma_object_class_is (new_arraybuffer_p, LIT_MAGIC_STRING_ARRAY_BUFFER_UL)) { - ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Return value is not an ArrayBuffer object.")); + ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Return value is not an ArrayBuffer object")); goto free_new_arraybuffer; } @@ -179,7 +179,7 @@ ecma_builtin_arraybuffer_prototype_object_slice (ecma_value_t this_arg, /**< thi /* 15. */ if (ecma_arraybuffer_is_detached (new_arraybuffer_p)) { - ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Return ArrayBuffer has been detached.")); + ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Returned ArrayBuffer has been detached")); goto free_new_arraybuffer; } @@ -193,14 +193,14 @@ ecma_builtin_arraybuffer_prototype_object_slice (ecma_value_t this_arg, /**< thi /* 17. */ if (ecma_arraybuffer_get_length (new_arraybuffer_p) < new_len) { - ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Derived ArrayBuffer constructor created a too small buffer.")); + ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Derived ArrayBuffer constructor created a too small buffer")); goto free_new_arraybuffer; } /* 19. */ if (ecma_arraybuffer_is_detached (object_p)) { - ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Original ArrayBuffer has been detached.")); + ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Original ArrayBuffer has been detached")); goto free_new_arraybuffer; } diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-prototype.c index 1f41d7c93..c866f6f42 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-prototype.c @@ -115,7 +115,7 @@ ecma_builtin_async_generator_prototype_dispatch_routine (uint8_t builtin_routine if (executable_object_p == NULL) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an async generator object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an async generator object")); } if (executable_object_p->extended_object.u.class_prop.extra_info & ECMA_EXECUTABLE_OBJECT_COMPLETED) diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-bigint-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-bigint-prototype.c index 99d98e864..020454917 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-bigint-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-bigint-prototype.c @@ -69,7 +69,7 @@ ecma_builtin_bigint_prototype_object_value_of (ecma_value_t this_arg) /**< this } } - return ecma_raise_type_error (ECMA_ERR_MSG ("BigInt value expected.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("BigInt value expected")); } /* ecma_builtin_bigint_prototype_object_value_of */ /** @@ -108,7 +108,7 @@ ecma_builtin_bigint_prototype_object_to_string (ecma_value_t this_arg, /**< this if (arg_num < 2 || arg_num > 36) { ecma_free_value (bigint); - return ecma_raise_range_error (ECMA_ERR_MSG ("Radix must be between 2 and 36.")); + return ecma_raise_range_error (ECMA_ERR_MSG ("Radix must be between 2 and 36")); } radix = (uint32_t) arg_num; diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-bigint.c b/jerry-core/ecma/builtin-objects/ecma-builtin-bigint.c index d298873a1..fd622e444 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-bigint.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-bigint.c @@ -68,7 +68,7 @@ ecma_builtin_bigint_dispatch_construct (const ecma_value_t *arguments_list_p, /* { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); - return ecma_raise_type_error (ECMA_ERR_MSG ("BigInt function is not a constructor.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("BigInt function is not a constructor")); } /* ecma_builtin_bigint_dispatch_construct */ /** diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-boolean-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-boolean-prototype.c index b6c85f209..e220f1d24 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-boolean-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-boolean-prototype.c @@ -88,7 +88,7 @@ ecma_builtin_boolean_prototype_object_value_of (ecma_value_t this_arg) /**< this } } - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a Boolean object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a Boolean object")); } /* ecma_builtin_boolean_prototype_object_value_of */ /** diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-dataview-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-dataview-prototype.c index 8075d1de2..cafbc3fb1 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-dataview-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-dataview-prototype.c @@ -122,7 +122,7 @@ ecma_builtin_dataview_prototype_object_getters (ecma_value_t this_arg, /**< this { if (ecma_arraybuffer_is_detached (obj_p->buffer_p)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached")); } return ecma_make_uint32_value (obj_p->header.u.class_prop.u.length); } @@ -132,7 +132,7 @@ ecma_builtin_dataview_prototype_object_getters (ecma_value_t this_arg, /**< this if (ecma_arraybuffer_is_detached (obj_p->buffer_p)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached")); } return ecma_make_uint32_value (obj_p->byte_offset); } diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-dataview.c b/jerry-core/ecma/builtin-objects/ecma-builtin-dataview.c index 4b98e681c..cd4b518f1 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-dataview.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-dataview.c @@ -47,7 +47,7 @@ ecma_builtin_dataview_dispatch_call (const ecma_value_t *arguments_list_p, /**< { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); - return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor DataView requires 'new'.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor DataView requires 'new'")); } /* ecma_builtin_dataview_dispatch_call */ /** diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.c index 16dcfb9b3..1a41ad83e 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.c @@ -214,7 +214,7 @@ ecma_builtin_date_prototype_to_primitive (ecma_value_t this_arg, /**< this argum } } - return ecma_raise_type_error (ECMA_ERR_MSG ("Invalid argument type in toPrimitive.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Invalid argument type in toPrimitive")); } /* ecma_builtin_date_prototype_to_primitive */ #endif /* ENABLED (JERRY_ESNEXT) */ @@ -607,7 +607,7 @@ ecma_builtin_date_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< b if (!ecma_is_value_object (this_arg) || !ecma_object_class_is (ecma_get_object_from_value (this_arg), LIT_MAGIC_STRING_DATE_UL)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("'this' is not a Date object")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a Date object")); } ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) ecma_get_object_from_value (this_arg); @@ -658,7 +658,7 @@ ecma_builtin_date_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< b { if (ecma_number_is_nan (*prim_value_p) || ecma_number_is_infinity (*prim_value_p)) { - return ecma_raise_range_error (ECMA_ERR_MSG ("Date must be a finite number.")); + return ecma_raise_range_error (ECMA_ERR_MSG ("Date must be a finite number")); } return ecma_date_value_to_iso_string (*prim_value_p); diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-error-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-error-prototype.c index cfc0d4adf..e2e8a1c1c 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-error-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-error-prototype.c @@ -86,7 +86,7 @@ ecma_builtin_error_prototype_object_to_string (ecma_value_t this_arg) /**< this /* 2. */ if (!ecma_is_value_object (this_arg)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object")); } ecma_object_t *obj_p = ecma_get_object_from_value (this_arg); diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.c index 8591cbbbe..19eb42d08 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.c @@ -107,7 +107,7 @@ ecma_builtin_function_prototype_object_apply (ecma_object_t *func_obj_p, /**< th /* 3. */ if (!ecma_is_value_object (arg2)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an object")); } ecma_object_t *obj_p = ecma_get_object_from_value (arg2); @@ -123,7 +123,7 @@ ecma_builtin_function_prototype_object_apply (ecma_object_t *func_obj_p, /**< th if (length >= ECMA_FUNCTION_APPLY_ARGUMENT_COUNT_LIMIT) { - return ecma_raise_range_error (ECMA_ERR_MSG ("Too many arguments declared for Function.apply().")); + return ecma_raise_range_error (ECMA_ERR_MSG ("Too many arguments declared for Function.apply")); } /* 6. */ @@ -406,7 +406,7 @@ ecma_builtin_function_prototype_dispatch_construct (const ecma_value_t *argument { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); - return ecma_raise_type_error (ECMA_ERR_MSG ("'Function.prototype' is not a constructor.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Function.prototype is not a constructor")); } /* ecma_builtin_function_prototype_dispatch_construct */ /** @@ -431,7 +431,7 @@ ecma_builtin_function_prototype_dispatch_routine (uint8_t builtin_routine_id, /* } #endif /* ENABLED (JERRY_ESNEXT) */ - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a function.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a function")); } ecma_object_t *func_obj_p = ecma_get_object_from_value (this_arg); diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-generator-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-generator-prototype.c index 66256ce68..b518e3e36 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-generator-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-generator-prototype.c @@ -228,12 +228,12 @@ ecma_builtin_generator_prototype_dispatch_routine (uint8_t builtin_routine_id, / if (executable_object_p == NULL) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a generator object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a generator object")); } if (executable_object_p->extended_object.u.class_prop.extra_info & ECMA_EXECUTABLE_OBJECT_RUNNING) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Generator is currently under execution.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Generator is currently under execution")); } if (executable_object_p->extended_object.u.class_prop.extra_info & ECMA_EXECUTABLE_OBJECT_COMPLETED) diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-global.c b/jerry-core/ecma/builtin-objects/ecma-builtin-global.c index b834e97fc..2ad06f28a 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-global.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-global.c @@ -216,7 +216,7 @@ ecma_builtin_global_object_decode_uri_helper (lit_utf8_byte_t *input_start_p, /* if (hex_value == UINT32_MAX) { ecma_stringbuilder_destroy (&builder); - return ecma_raise_uri_error (ECMA_ERR_MSG ("Invalid hexadecimal value.")); + return ecma_raise_uri_error (ECMA_ERR_MSG ("Invalid hexadecimal value")); } ecma_char_t decoded_byte = (ecma_char_t) hex_value; @@ -254,7 +254,7 @@ ecma_builtin_global_object_decode_uri_helper (lit_utf8_byte_t *input_start_p, /* else { ecma_stringbuilder_destroy (&builder); - return ecma_raise_uri_error (ECMA_ERR_MSG ("Invalid UTF8 character.")); + return ecma_raise_uri_error (ECMA_ERR_MSG ("Invalid UTF8 character")); } lit_utf8_byte_t octets[LIT_UTF8_MAX_BYTES_IN_CODE_POINT]; @@ -287,7 +287,7 @@ ecma_builtin_global_object_decode_uri_helper (lit_utf8_byte_t *input_start_p, /* || !lit_is_valid_utf8_string (octets, bytes_count)) { ecma_stringbuilder_destroy (&builder); - return ecma_raise_uri_error (ECMA_ERR_MSG ("Invalid UTF8 string.")); + return ecma_raise_uri_error (ECMA_ERR_MSG ("Invalid UTF8 string")); } lit_code_point_t cp; @@ -297,7 +297,7 @@ ecma_builtin_global_object_decode_uri_helper (lit_utf8_byte_t *input_start_p, /* || lit_is_code_point_utf16_low_surrogate (cp)) { ecma_stringbuilder_destroy (&builder); - return ecma_raise_uri_error (ECMA_ERR_MSG ("Invalid UTF8 codepoint.")); + return ecma_raise_uri_error (ECMA_ERR_MSG ("Invalid UTF8 codepoint")); } lit_utf8_byte_t result_chars[LIT_CESU8_MAX_BYTES_IN_CODE_POINT]; @@ -356,7 +356,7 @@ ecma_builtin_global_object_encode_uri_helper (lit_utf8_byte_t *input_start_p, /* if (lit_is_code_point_utf16_low_surrogate (ch)) { ecma_stringbuilder_destroy (&builder); - return ecma_raise_uri_error (ECMA_ERR_MSG ("Unicode surrogate pair missing.")); + return ecma_raise_uri_error (ECMA_ERR_MSG ("Unicode surrogate pair missing")); } lit_code_point_t cp = ch; @@ -366,7 +366,7 @@ ecma_builtin_global_object_encode_uri_helper (lit_utf8_byte_t *input_start_p, /* if (input_char_p == input_end_p) { ecma_stringbuilder_destroy (&builder); - return ecma_raise_uri_error (ECMA_ERR_MSG ("Unicode surrogate pair missing.")); + return ecma_raise_uri_error (ECMA_ERR_MSG ("Unicode surrogate pair missing")); } ecma_char_t next_ch; @@ -380,7 +380,7 @@ ecma_builtin_global_object_encode_uri_helper (lit_utf8_byte_t *input_start_p, /* else { ecma_stringbuilder_destroy (&builder); - return ecma_raise_uri_error (ECMA_ERR_MSG ("Unicode surrogate pair missing.")); + return ecma_raise_uri_error (ECMA_ERR_MSG ("Unicode surrogate pair missing")); } } diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c b/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c index 041e78707..9a569bc78 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c @@ -369,7 +369,7 @@ ecma_builtin_helper_array_concat_value (ecma_object_t *array_obj_p, /**< array * /* 4 . */ if ((ecma_number_t) (*length_p + arg_len) > ECMA_NUMBER_MAX_SAFE_INTEGER) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Invalid array length.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Invalid array length")); } #else /* !ENABLED (JERRY_ESNEXT) */ /* 5.b.ii */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-intrinsic.c b/jerry-core/ecma/builtin-objects/ecma-builtin-intrinsic.c index 2cdd3d009..d20479d6d 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-intrinsic.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-intrinsic.c @@ -171,12 +171,12 @@ ecma_builtin_intrinsic_dispatch_routine (uint8_t builtin_routine_id, /**< built- { if (!ecma_is_typedarray (this_arg)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a TypedArray.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a TypedArray")); } if (ecma_arraybuffer_is_detached (ecma_typedarray_get_arraybuffer (ecma_get_object_from_value (this_arg)))) { - return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached")); } return ecma_typedarray_iterators_helper (this_arg, ECMA_ITERATOR_VALUES); @@ -207,7 +207,7 @@ ecma_builtin_intrinsic_dispatch_routine (uint8_t builtin_routine_id, /**< built- if (!ecma_is_value_object (this_arg) || !ecma_object_class_is (ecma_get_object_from_value (this_arg), LIT_MAGIC_STRING_DATE_UL)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("'this' is not a Date object")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a Date object")); } ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) ecma_get_object_from_value (this_arg); diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-json.c b/jerry-core/ecma/builtin-objects/ecma-builtin-json.c index 8be7c8bd6..99999548d 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-json.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-json.c @@ -818,7 +818,7 @@ ecma_builtin_json_parse_buffer (const lit_utf8_byte_t * str_start_p, /**< String ecma_free_value (result); } - return ecma_raise_syntax_error (ECMA_ERR_MSG ("Invalid JSON format.")); + return ecma_raise_syntax_error (ECMA_ERR_MSG ("Invalid JSON format")); } /*ecma_builtin_json_parse_buffer*/ /** @@ -1000,7 +1000,7 @@ ecma_builtin_json_serialize_object (ecma_json_stringify_context_t *context_p, /* /* 1. */ if (ecma_json_has_object_in_stack (context_p->occurence_stack_last_p, obj_p)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("The structure is cyclical.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("The structure is cyclical")); } /* 2. */ @@ -1137,7 +1137,7 @@ ecma_builtin_json_serialize_array (ecma_json_stringify_context_t *context_p, /** /* 1. */ if (ecma_json_has_object_in_stack (context_p->occurence_stack_last_p, obj_p)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("The structure is cyclical.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("The structure is cyclical")); } /* 2. */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-map.c b/jerry-core/ecma/builtin-objects/ecma-builtin-map.c index 0a9298c9e..4c758c87b 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-map.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-map.c @@ -47,7 +47,7 @@ ecma_builtin_map_dispatch_call (const ecma_value_t *arguments_list_p, /**< argum { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); - return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor Map requires 'new'.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor Map requires 'new'")); } /* ecma_builtin_map_dispatch_call */ /** diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.c index 3e7548679..cd1873904 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.c @@ -168,7 +168,7 @@ ecma_builtin_number_prototype_object_to_string (ecma_number_t this_arg_number, / if (radix < 2 || radix > 36) { - return ecma_raise_range_error (ECMA_ERR_MSG ("Radix must be between 2 and 36.")); + return ecma_raise_range_error (ECMA_ERR_MSG ("Radix must be between 2 and 36")); } } @@ -456,7 +456,7 @@ ecma_builtin_number_prototype_object_value_of (ecma_value_t this_arg) /**< this } } - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a Number or a Number object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a number or a Number object")); } /* ecma_builtin_number_prototype_object_value_of */ /** @@ -496,7 +496,7 @@ ecma_builtin_number_prototype_object_to_number_convert (ecma_number_t this_num, if (mode == NUMBER_ROUTINE_TO_FIXED && (arg_num <= -1 || arg_num >= 101)) { - return ecma_raise_range_error (ECMA_ERR_MSG ("Fraction digits must be between 0 and 100.")); + return ecma_raise_range_error (ECMA_ERR_MSG ("Fraction digits must be between 0 and 100")); } /* Handle NaN separately */ @@ -565,13 +565,13 @@ ecma_builtin_number_prototype_object_to_number_convert (ecma_number_t this_num, && (arg_num <= -1 || arg_num >= 101)) { ecma_stringbuilder_destroy (&builder); - return ecma_raise_range_error (ECMA_ERR_MSG ("Fraction digits must be between 0 and 100.")); + return ecma_raise_range_error (ECMA_ERR_MSG ("Fraction digits must be between 0 and 100")); } else if (mode == NUMBER_ROUTINE_TO_PRECISION && (arg_num < 1 || arg_num > 100)) { ecma_stringbuilder_destroy (&builder); - return ecma_raise_range_error (ECMA_ERR_MSG ("Precision digits must be between 1 and 100.")); + return ecma_raise_range_error (ECMA_ERR_MSG ("Precision digits must be between 1 and 100")); } num_of_digits = ecma_number_to_decimal (this_num, digits, &exponent); diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-object-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-object-prototype.c index 8c6c52b5c..46fae4fdb 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-object-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-object-prototype.c @@ -240,7 +240,7 @@ ecma_builtin_object_prototype_define_getter_setter (ecma_value_t this_arg, /**< if (!ecma_op_is_callable (accessor)) { ecma_deref_object (obj_p); - return ecma_raise_type_error (ECMA_ERR_MSG ("Getter is not callable.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Getter is not callable")); } ecma_object_t *accessor_obj_p = ecma_get_object_from_value (accessor); diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-object.c b/jerry-core/ecma/builtin-objects/ecma-builtin-object.c index b96d3ce32..254d7bed9 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-object.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-object.c @@ -198,7 +198,7 @@ ecma_builtin_object_object_set_prototype_of (ecma_value_t arg1, /**< routine's f /* 3. */ if (!ecma_is_value_object (arg2) && !ecma_is_value_null (arg2)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("proto is neither Object nor Null.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Prototype is neither object nor null")); } /* 4. */ @@ -231,7 +231,7 @@ ecma_builtin_object_object_set_prototype_of (ecma_value_t arg1, /**< routine's f if (ecma_is_value_false (status)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Cannot set [[Prototype]].")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Cannot set [[Prototype]]")); } JERRY_ASSERT (ecma_is_value_true (status)); @@ -295,7 +295,7 @@ ecma_builtin_object_object_set_proto (ecma_value_t arg1, /**< routine's first ar if (ecma_is_value_false (status)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Cannot set [[Prototype]].")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Cannot set [[Prototype]]")); } JERRY_ASSERT (ecma_is_value_true (status)); @@ -470,7 +470,7 @@ ecma_builtin_object_object_seal (ecma_object_t *obj_p) /**< routine's argument * #if ENABLED (JERRY_BUILTIN_PROXY) if (ecma_is_value_false (status)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Object cannot be sealed.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Object cannot be sealed")); } #endif /* ENABLED (JERRY_BUILTIN_PROXY) */ @@ -501,7 +501,7 @@ ecma_builtin_object_object_freeze (ecma_object_t *obj_p) /**< routine's argument #if ENABLED (JERRY_BUILTIN_PROXY) if (ecma_is_value_false (status)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Object cannot be frozen.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Object cannot be frozen")); } #endif /* ENABLED (JERRY_BUILTIN_PROXY) */ @@ -534,7 +534,7 @@ ecma_builtin_object_object_prevent_extensions (ecma_object_t *obj_p) /**< routin if (ecma_is_value_false (status)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Cannot set [[Extensible]] property of the object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Cannot set [[Extensible]] property of object")); } JERRY_ASSERT (ecma_is_value_true (status)); @@ -956,7 +956,7 @@ ecma_builtin_object_object_create (ecma_value_t arg1, /**< routine's first argum /* 1. */ if (!ecma_is_value_object (arg1) && !ecma_is_value_null (arg1)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an object")); } ecma_object_t *obj_p = NULL; @@ -1025,7 +1025,7 @@ ecma_builtin_object_object_define_property (ecma_object_t *obj_p, /**< routine's if (ecma_is_value_false (define_own_prop_ret)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("The requested property update cannot be performed.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("The requested property update cannot be performed")); } JERRY_ASSERT (ecma_is_value_true (define_own_prop_ret)); @@ -1226,7 +1226,7 @@ ecma_builtin_object_from_entries (ecma_value_t iterator) /**< object's iterator if (!ecma_is_value_object (result)) { ecma_free_value (result); - ecma_raise_type_error (ECMA_ERR_MSG ("Iterator value is not an object.")); + ecma_raise_type_error (ECMA_ERR_MSG ("Iterator value is not an object")); result = ecma_op_iterator_close (original_iterator); JERRY_ASSERT (ECMA_IS_VALUE_ERROR (result)); goto cleanup_iterator; @@ -1415,7 +1415,7 @@ ecma_builtin_object_dispatch_routine (uint8_t builtin_routine_id, /**< built-in #if !ENABLED (JERRY_ESNEXT) if (!ecma_is_value_object (arg1)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an object")); } #endif /* !ENABLED (JERRY_ESNEXT) */ @@ -1424,7 +1424,7 @@ ecma_builtin_object_dispatch_routine (uint8_t builtin_routine_id, /**< built-in #if ENABLED (JERRY_ESNEXT) if (!ecma_is_value_object (arg1)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an object")); } #endif /* ENABLED (JERRY_ESNEXT) */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-promise.c b/jerry-core/ecma/builtin-objects/ecma-builtin-promise.c index c60ff41e6..87e5a6491 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-promise.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-promise.c @@ -136,7 +136,7 @@ ecma_builtin_promise_perform_race (ecma_value_t iterator, /**< the iterator for if (!ecma_op_is_callable (resolve)) { ecma_free_value (resolve); - return ecma_raise_type_error (ECMA_ERR_MSG ("Resolve method must be callable.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Resolve method must be callable")); } ecma_object_t *resolve_func_p = ecma_get_object_from_value (resolve); @@ -233,7 +233,7 @@ ecma_builtin_promise_perform_all (ecma_value_t iterator, /**< iteratorRecord */ if (!ecma_op_is_callable (resolve)) { ecma_free_value (resolve); - return ecma_raise_type_error (ECMA_ERR_MSG ("Resolve method must be callable.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Resolve method must be callable")); } ecma_object_t *resolve_func_p = ecma_get_object_from_value (resolve); @@ -312,7 +312,7 @@ ecma_builtin_promise_perform_all (ecma_value_t iterator, /**< iteratorRecord */ if (JERRY_UNLIKELY (idx == UINT32_MAX - 1)) { - ecma_raise_range_error (ECMA_ERR_MSG ("Promise.all remaining elements limit reached.")); + ecma_raise_range_error (ECMA_ERR_MSG ("Promise.all remaining elements limit reached")); goto exit; } @@ -436,7 +436,7 @@ ecma_builtin_promise_dispatch_call (const ecma_value_t *arguments_list_p, /**< a { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); - return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor Promise requires 'new'.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor Promise requires 'new'")); } /* ecma_builtin_promise_dispatch_call */ /** @@ -452,7 +452,7 @@ ecma_builtin_promise_dispatch_construct (const ecma_value_t *arguments_list_p, / if (arguments_list_len == 0 || !ecma_op_is_callable (arguments_list_p[0])) { - return ecma_raise_type_error (ECMA_ERR_MSG ("First parameter must be callable.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("First parameter must be callable")); } return ecma_op_create_promise_object (arguments_list_p[0], ECMA_PROMISE_EXECUTOR_FUNCTION); diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-reflect.c b/jerry-core/ecma/builtin-objects/ecma-builtin-reflect.c index d912a4433..a1da681e5 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-reflect.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-reflect.c @@ -91,7 +91,7 @@ ecma_builtin_reflect_dispatch_routine (uint8_t builtin_routine_id, /**< built-in /* 1. */ if (arguments_number == 0 || !ecma_is_value_object (arguments_list[0])) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an Object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an object")); } /* 2. */ @@ -159,7 +159,7 @@ ecma_builtin_reflect_dispatch_routine (uint8_t builtin_routine_id, /**< built-in /* 1. */ if (arguments_number == 0 || !ecma_is_value_object (arguments_list[0])) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an Object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an object")); } ecma_object_t *target_p = ecma_get_object_from_value (arguments_list[0]); @@ -205,7 +205,7 @@ ecma_builtin_reflect_dispatch_routine (uint8_t builtin_routine_id, /**< built-in /* 4. */ if (arguments_number < 2) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Reflect.construct requires the second argument be an object")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Reflect.construct expects an object as second argument")); } ecma_collection_t *coll_p = ecma_op_create_list_from_array_like (arguments_list[1], false); @@ -226,7 +226,7 @@ ecma_builtin_reflect_dispatch_routine (uint8_t builtin_routine_id, /**< built-in if (!ecma_is_value_object (arguments_list[0])) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an Object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an object")); } switch (builtin_routine_id) @@ -239,7 +239,7 @@ ecma_builtin_reflect_dispatch_routine (uint8_t builtin_routine_id, /**< built-in { if (!ecma_is_value_object (arguments_list[1]) && !ecma_is_value_null (arguments_list[1])) { - return ecma_raise_type_error (ECMA_ERR_MSG ("proto is neither Object nor Null.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Prototype is neither object nor null")); } ecma_object_t *obj_p = ecma_get_object_from_value (arguments_list[0]); @@ -262,7 +262,7 @@ ecma_builtin_reflect_dispatch_routine (uint8_t builtin_routine_id, /**< built-in { if (!ecma_op_is_callable (arguments_list[0])) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a function.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a function")); } ecma_object_t *func_obj_p = ecma_get_object_from_value (arguments_list[0]); diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.c index ca4681daa..027f1b210 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.c @@ -280,7 +280,7 @@ ecma_builtin_regexp_prototype_compile (ecma_value_t this_arg, /**< this */ #if !ENABLED (JERRY_ESNEXT) if (ecma_get_object_from_value (this_arg) == ecma_builtin_get (ECMA_BUILTIN_ID_REGEXP_PROTOTYPE)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("'this' is not a RegExp object")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a RegExp object")); } #endif /* !ENABLED (JERRY_ESNEXT) */ @@ -679,23 +679,21 @@ ecma_builtin_regexp_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< ecma_object_t *obj_p = NULL; + /* 1. && 2. */ if (ecma_is_value_object (this_arg)) { - /* 2. */ obj_p = ecma_get_object_from_value (this_arg); if (require_regexp && !ecma_object_class_is (obj_p, LIT_MAGIC_STRING_REGEXP_UL)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("'this' is not a RegExp object")); + obj_p = NULL; } } - /* 1. */ - else - { - return ecma_raise_type_error (ECMA_ERR_MSG ("'this' is not an object")); - } - JERRY_ASSERT (obj_p != NULL); + if (obj_p == NULL) + { + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object")); + } switch (builtin_routine_id) { @@ -751,7 +749,7 @@ ecma_builtin_regexp_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< return ecma_make_magic_string_value (LIT_MAGIC_STRING_EMPTY_NON_CAPTURE_GROUP); } - return ecma_raise_type_error (ECMA_ERR_MSG ("'this' is not a RegExp object")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a RegExp object")); } ecma_extended_object_t *re_obj_p = (ecma_extended_object_t *) obj_p; @@ -771,7 +769,7 @@ ecma_builtin_regexp_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< return ECMA_VALUE_UNDEFINED; } - return ecma_raise_type_error (ECMA_ERR_MSG ("'this' is not a RegExp object")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a RegExp object")); } ecma_extended_object_t *re_obj_p = (ecma_extended_object_t *) obj_p; diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-string-iterator-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-string-iterator-prototype.c index 9839bc3a8..f7faf0d20 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-string-iterator-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-string-iterator-prototype.c @@ -57,7 +57,7 @@ ecma_builtin_regexp_string_iterator_prototype_object_next (ecma_value_t this_val /* 2. */ if (!ecma_is_value_object (this_val)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object")); } ecma_object_t *obj_p = ecma_get_object_from_value (this_val); @@ -67,7 +67,7 @@ ecma_builtin_regexp_string_iterator_prototype_object_next (ecma_value_t this_val if (ecma_get_object_type (obj_p) != ECMA_OBJECT_TYPE_PSEUDO_ARRAY || ext_obj_p->u.pseudo_array.type != ECMA_PSEUDO_REGEXP_STRING_ITERATOR) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an iterator.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an iterator")); } ecma_regexp_string_iterator_t *regexp_string_iterator_obj = (ecma_regexp_string_iterator_t *) obj_p; diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp.c b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp.c index de0af72e8..5df1647b1 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp.c @@ -152,7 +152,7 @@ ecma_builtin_regexp_dispatch_helper (const ecma_value_t *arguments_list_p, /**< return ecma_copy_value (pattern_value); } - return ecma_raise_type_error (ECMA_ERR_MSG ("Invalid argument of RegExp call.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Invalid argument is passed to RegExp function")); } #endif /* ENABLED (JERRY_ESNEXT) */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-set.c b/jerry-core/ecma/builtin-objects/ecma-builtin-set.c index 391b07b97..55449b24b 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-set.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-set.c @@ -47,7 +47,7 @@ ecma_builtin_set_dispatch_call (const ecma_value_t *arguments_list_p, /**< argum { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); - return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor Set requires 'new'.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor Set requires 'new'")); } /* ecma_builtin_set_dispatch_call */ /** diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-string-iterator-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-string-iterator-prototype.c index e2f6c52c0..be0cda669 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-string-iterator-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-string-iterator-prototype.c @@ -54,7 +54,7 @@ ecma_builtin_string_iterator_prototype_object_next (ecma_value_t this_val) /**< /* 1 - 2. */ if (!ecma_is_value_object (this_val)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object")); } ecma_object_t *obj_p = ecma_get_object_from_value (this_val); @@ -64,7 +64,7 @@ ecma_builtin_string_iterator_prototype_object_next (ecma_value_t this_val) /**< if (ecma_get_object_type (obj_p) != ECMA_OBJECT_TYPE_PSEUDO_ARRAY || ext_obj_p->u.pseudo_array.type != ECMA_PSEUDO_STRING_ITERATOR) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an iterator.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an iterator")); } ecma_value_t iterated_value = ext_obj_p->u.pseudo_array.u2.iterated_value; @@ -84,7 +84,7 @@ ecma_builtin_string_iterator_prototype_object_next (ecma_value_t this_val) /**< if (JERRY_UNLIKELY (position == ECMA_ITERATOR_INDEX_LIMIT)) { - return ecma_raise_range_error (ECMA_ERR_MSG ("String iteration cannot be continued.")); + return ecma_raise_range_error (ECMA_ERR_MSG ("String iteration cannot be continued")); } /* 7. */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.c index 04d591771..6e251db67 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.c @@ -140,7 +140,7 @@ ecma_builtin_string_prototype_object_to_string (ecma_value_t this_arg) /**< this } } - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a String or a String object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a string or a String object")); } /* ecma_builtin_string_prototype_object_to_string */ /** @@ -447,7 +447,7 @@ ecma_builtin_string_prototype_object_match_all (ecma_value_t this_argument, /**< if (!(parsed_flag & RE_FLAG_GLOBAL)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("RegExp argument should have global flag.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("RegExp argument should have global flag")); } } @@ -567,7 +567,7 @@ ecma_builtin_string_prototype_object_replace_helper (ecma_value_t this_value, /* if (!have_global_flag) { - return ecma_raise_type_error (ECMA_ERR_MSG ("RegExp argument should have global flag.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("RegExp argument should have global flag")); } } } diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-string.c b/jerry-core/ecma/builtin-objects/ecma-builtin-string.c index 8a338f9b3..2ba965d37 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-string.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-string.c @@ -309,7 +309,7 @@ ecma_builtin_string_object_from_code_point (ecma_value_t this_arg, /**< 'this' a if (to_number_num < 0 || to_number_num > LIT_UNICODE_CODE_POINT_MAX) { ecma_stringbuilder_destroy (&builder); - return ecma_raise_range_error (ECMA_ERR_MSG ("Error: Invalid code point")); + return ecma_raise_range_error (ECMA_ERR_MSG ("Invalid code point")); } lit_code_point_t code_point = (lit_code_point_t) to_number_num; diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-symbol.c b/jerry-core/ecma/builtin-objects/ecma-builtin-symbol.c index d8cd35298..5668492db 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-symbol.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-symbol.c @@ -75,7 +75,7 @@ ecma_builtin_symbol_dispatch_construct (const ecma_value_t *arguments_list_p, /* { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); - return ecma_raise_type_error (ECMA_ERR_MSG ("Symbol is not a constructor.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Symbol is not a constructor")); } /* ecma_builtin_symbol_dispatch_construct */ /** @@ -242,7 +242,7 @@ ecma_builtin_symbol_key_for (ecma_value_t this_arg, /**< this argument */ /* 1. */ if (!ecma_is_value_symbol (symbol)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("The given argument is not a Symbol.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("The given argument is not a Symbol")); } /* 2-4. */ diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap.c b/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap.c index ee426eb93..3e0cd2dee 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap.c @@ -47,7 +47,7 @@ ecma_builtin_weakmap_dispatch_call (const ecma_value_t *arguments_list_p, /**< a { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); - return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor WeakMap requires 'new'.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor WeakMap requires 'new'")); } /* ecma_builtin_weakmap_dispatch_call */ /** diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-weakset.c b/jerry-core/ecma/builtin-objects/ecma-builtin-weakset.c index db085ab38..538f7dee6 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtin-weakset.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtin-weakset.c @@ -47,7 +47,7 @@ ecma_builtin_weakset_dispatch_call (const ecma_value_t *arguments_list_p, /**< a { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); - return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor WeakSet requires 'new'.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor WeakSet requires 'new'")); } /* ecma_builtin_weakset_dispatch_call */ /** diff --git a/jerry-core/ecma/builtin-objects/ecma-builtins.c b/jerry-core/ecma/builtin-objects/ecma-builtins.c index 296ee0ca0..6de1bd8e3 100644 --- a/jerry-core/ecma/builtin-objects/ecma-builtins.c +++ b/jerry-core/ecma/builtin-objects/ecma-builtins.c @@ -1545,7 +1545,7 @@ ecma_builtin_dispatch_construct (ecma_object_t *obj_p, /**< built-in object */ if (ecma_builtin_function_is_routine (obj_p)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Built-in routines have no constructor.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Built-in routines have no constructor")); } ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p; diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array.c index 231815851..30dd36091 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array.c @@ -54,7 +54,7 @@ ecma_builtin_bigint64array_dispatch_call (const ecma_value_t *arguments_list_p, { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); - return ecma_raise_type_error (ECMA_ERR_MSG ("BigInt64Array cannot be directly called")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor BigInt64Array requires 'new'")); } /* ecma_builtin_bigint64array_dispatch_call */ /** diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array.c index e3740c43e..734adfa84 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array.c @@ -54,7 +54,7 @@ ecma_builtin_biguint64array_dispatch_call (const ecma_value_t *arguments_list_p, { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); - return ecma_raise_type_error (ECMA_ERR_MSG ("BigUInt64Array cannot be directly called")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor BigUInt64Array requires 'new'")); } /* ecma_builtin_biguint64array_dispatch_call */ /** diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array.c index a1e6025a5..1332b64dc 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array.c @@ -53,7 +53,7 @@ ecma_builtin_float32array_dispatch_call (const ecma_value_t *arguments_list_p, / { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); - return ecma_raise_type_error (ECMA_ERR_MSG ("Float32Array cannot be directly called")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor Float32Array requires 'new'")); } /* ecma_builtin_float32array_dispatch_call */ /** diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array.c index 742cc1751..79eb95a5a 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array.c @@ -54,7 +54,7 @@ ecma_builtin_float64array_dispatch_call (const ecma_value_t *arguments_list_p, / { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); - return ecma_raise_type_error (ECMA_ERR_MSG ("Float64Array cannot be directly called")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor Float64Array requires 'new'")); } /* ecma_builtin_float64array_dispatch_call */ /** diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array.c index a626d78b8..2c05944b4 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array.c @@ -53,7 +53,7 @@ ecma_builtin_int16array_dispatch_call (const ecma_value_t *arguments_list_p, /** { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); - return ecma_raise_type_error (ECMA_ERR_MSG ("Int16Array cannot be directly called")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor Int16Array requires 'new'")); } /* ecma_builtin_int16array_dispatch_call */ /** diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array.c index d2eabbeed..e6393cdb5 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array.c @@ -53,7 +53,7 @@ ecma_builtin_int32array_dispatch_call (const ecma_value_t *arguments_list_p, /** { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); - return ecma_raise_type_error (ECMA_ERR_MSG ("Int32Array cannot be directly called")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor Int32Array requires 'new'")); } /* ecma_builtin_int32array_dispatch_call */ /** diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array.c index 094e9cd83..fc3a18f0f 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array.c @@ -53,7 +53,7 @@ ecma_builtin_int8array_dispatch_call (const ecma_value_t *arguments_list_p, /**< { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); - return ecma_raise_type_error (ECMA_ERR_MSG ("Int8Array cannot be directly called")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor Int8Array requires 'new'")); } /* ecma_builtin_int8array_dispatch_call */ /** diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.c index 1b105c683..c4d3cec8e 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.c @@ -275,7 +275,7 @@ ecma_builtin_typedarray_prototype_reduce_with_direction (ecma_value_t this_arg, { if (arguments_number < 2) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Initial value cannot be undefined.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Initial value cannot be undefined")); } return ecma_copy_value (arguments_list_p[1]); @@ -511,7 +511,7 @@ ecma_op_typedarray_set_with_typedarray (ecma_value_t this_arg, /**< this argumen ecma_object_t *arraybuffer_p = ecma_typedarray_get_arraybuffer (target_typedarray_p); if (ecma_arraybuffer_is_detached (arraybuffer_p)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached")); } ecma_typedarray_info_t target_info = ecma_typedarray_get_info (target_typedarray_p); @@ -520,7 +520,7 @@ ecma_op_typedarray_set_with_typedarray (ecma_value_t this_arg, /**< this argumen ecma_object_t *src_arraybuffer_p = ecma_typedarray_get_arraybuffer (src_typedarray_p); if (ecma_arraybuffer_is_detached (src_arraybuffer_p)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached")); } ecma_typedarray_info_t src_info = ecma_typedarray_get_info (src_typedarray_p); @@ -614,7 +614,7 @@ ecma_builtin_typedarray_prototype_set (ecma_value_t this_arg, /**< this argument ecma_object_t *arraybuffer_p = ecma_typedarray_get_arraybuffer (typedarray_p); if (ecma_arraybuffer_is_detached (arraybuffer_p)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached")); } ecma_typedarray_info_t target_info = ecma_typedarray_get_info (typedarray_p); @@ -1710,7 +1710,7 @@ ecma_builtin_typedarray_prototype_dispatch_routine (uint8_t builtin_routine_id, return ECMA_VALUE_UNDEFINED; } - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a TypedArray.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a TypedArray")); } ecma_object_t *typedarray_p = ecma_get_object_from_value (this_arg); @@ -1723,13 +1723,13 @@ ecma_builtin_typedarray_prototype_dispatch_routine (uint8_t builtin_routine_id, if (ecma_arraybuffer_is_detached (info.array_buffer_p) && builtin_routine_id != ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_SUBARRAY) { - return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached")); } } if (builtin_routine_id < ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_INDEX_OF && !ecma_op_is_callable (arguments_list_p[0])) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Callback function is not callable.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Callback function is not callable")); } switch (builtin_routine_id) @@ -1796,7 +1796,7 @@ ecma_builtin_typedarray_prototype_dispatch_routine (uint8_t builtin_routine_id, { if (!ecma_is_value_undefined (arguments_list_p[0]) && !ecma_op_is_callable (arguments_list_p[0])) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Callback function is not callable.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Callback function is not callable")); } return ecma_builtin_typedarray_prototype_sort (this_arg, &info, arguments_list_p[0]); diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray.c index 22971a11b..56d51f4af 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray.c @@ -62,7 +62,7 @@ ecma_builtin_typedarray_from (ecma_value_t this_arg, /**< 'this' argument */ if (!ecma_is_constructor (this_arg)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("'this' is not a constructor.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a constructor")); } ecma_value_t source; @@ -71,7 +71,7 @@ ecma_builtin_typedarray_from (ecma_value_t this_arg, /**< 'this' argument */ if (arguments_list_len == 0) { - return ecma_raise_type_error (ECMA_ERR_MSG ("no source argument")); + return ecma_raise_type_error (ECMA_ERR_MSG ("No source argument")); } source = arguments_list_p[0]; @@ -82,7 +82,7 @@ ecma_builtin_typedarray_from (ecma_value_t this_arg, /**< 'this' argument */ if (!ecma_op_is_callable (map_fn)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("mapfn argument is not callable")); + return ecma_raise_type_error (ECMA_ERR_MSG ("The 'mapfn' argument is not callable")); } if (arguments_list_len > 2) @@ -96,7 +96,7 @@ ecma_builtin_typedarray_from (ecma_value_t this_arg, /**< 'this' argument */ const uint8_t builtin_id = ecma_get_object_builtin_id (obj_p); if (!ecma_typedarray_helper_is_typedarray (builtin_id)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("'this' is not a typedarray constructor")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a TypedArray constructor")); } ecma_typedarray_type_t typedarray_id = ecma_typedarray_helper_builtin_to_typedarray_id (builtin_id); @@ -129,7 +129,7 @@ ecma_builtin_typedarray_of (ecma_value_t this_arg, /**< 'this' argument */ { if (!ecma_is_constructor (this_arg)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("'this' is not a constructor.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a constructor")); } ecma_object_t *obj_p = ecma_get_object_from_value (this_arg); @@ -137,7 +137,7 @@ ecma_builtin_typedarray_of (ecma_value_t this_arg, /**< 'this' argument */ if (!ecma_typedarray_helper_is_typedarray (builtin_id)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("'this' is not a typedarray constructor")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a TypedArray constructor")); } ecma_typedarray_type_t typedarray_id = ecma_typedarray_helper_builtin_to_typedarray_id (builtin_id); diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array.c index b1688864c..a6c5c025b 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array.c @@ -53,7 +53,7 @@ ecma_builtin_uint16array_dispatch_call (const ecma_value_t *arguments_list_p, /* { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); - return ecma_raise_type_error (ECMA_ERR_MSG ("Uint16Array cannot be directly called")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor Uint16Array requires 'new'")); } /* ecma_builtin_uint16array_dispatch_call */ /** diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array.c index 91e8a7e5d..9628171bd 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array.c @@ -53,7 +53,7 @@ ecma_builtin_uint32array_dispatch_call (const ecma_value_t *arguments_list_p, /* { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); - return ecma_raise_type_error (ECMA_ERR_MSG ("Uint32Array cannot be directly called")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor Uint32Array requires 'new'")); } /* ecma_builtin_uint32array_dispatch_call */ /** diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array.c index d4cb9911a..1dd946e0b 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array.c @@ -53,7 +53,7 @@ ecma_builtin_uint8array_dispatch_call (const ecma_value_t *arguments_list_p, /** { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); - return ecma_raise_type_error (ECMA_ERR_MSG ("Uint8Array cannot be directly called")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor Uint8Array requires 'new'")); } /* ecma_builtin_uint8array_dispatch_call */ /** diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray.c index cc325992d..d17e4c4b6 100644 --- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray.c +++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray.c @@ -53,7 +53,7 @@ ecma_builtin_uint8clampedarray_dispatch_call (const ecma_value_t *arguments_list { JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL); - return ecma_raise_type_error (ECMA_ERR_MSG ("Uint8ClampedArray cannot be directly called")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor Uint8ClampedArray requires 'new'")); } /* ecma_builtin_uint8clampedarray_dispatch_call */ /** diff --git a/jerry-core/ecma/operations/ecma-array-object.c b/jerry-core/ecma/operations/ecma-array-object.c index 7592199c2..4ee2a4920 100644 --- a/jerry-core/ecma/operations/ecma-array-object.c +++ b/jerry-core/ecma/operations/ecma-array-object.c @@ -173,7 +173,7 @@ ecma_op_new_array_object_from_length (ecma_length_t length) /**< length of the n #if ENABLED (JERRY_ESNEXT) if (length > UINT32_MAX) { - ecma_raise_range_error (ECMA_ERR_MSG ("Invalid array length")); + ecma_raise_range_error (ECMA_ERR_MSG ("Invalid Array length")); return NULL; } #endif /* ENABLED (JERRY_ESNEXT) */ @@ -997,7 +997,7 @@ ecma_op_array_object_set_length (ecma_object_t *object_p, /**< the array object if (((ecma_number_t) new_len_uint32) != new_len_num) { - return ecma_raise_range_error (ECMA_ERR_MSG ("Invalid array length.")); + return ecma_raise_range_error (ECMA_ERR_MSG ("Invalid Array length")); } if (flags & ECMA_ARRAY_OBJECT_SET_LENGTH_FLAG_REJECT) diff --git a/jerry-core/ecma/operations/ecma-arraybuffer-object.c b/jerry-core/ecma/operations/ecma-arraybuffer-object.c index c29cd81ed..8f45ffe4d 100644 --- a/jerry-core/ecma/operations/ecma-arraybuffer-object.c +++ b/jerry-core/ecma/operations/ecma-arraybuffer-object.c @@ -137,7 +137,7 @@ ecma_op_create_arraybuffer_object (const ecma_value_t *arguments_list_p, /**< li if (length_num <= -1.0 || length_num > (ecma_number_t) maximum_size_in_byte + 0.5) { - return ecma_raise_range_error (ECMA_ERR_MSG ("Invalid ArrayBuffer length.")); + return ecma_raise_range_error (ECMA_ERR_MSG ("Invalid ArrayBuffer length")); } } diff --git a/jerry-core/ecma/operations/ecma-async-generator-object.c b/jerry-core/ecma/operations/ecma-async-generator-object.c index bc353a53b..78094b302 100644 --- a/jerry-core/ecma/operations/ecma-async-generator-object.c +++ b/jerry-core/ecma/operations/ecma-async-generator-object.c @@ -153,13 +153,13 @@ ecma_async_yield_throw (vm_executable_object_t *async_generator_object_p, /**< a if (result == ECMA_VALUE_UNDEFINED) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator throw() is not available.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator 'throw' is not available")); } result = ecma_async_yield_call (result, async_generator_object_p, ECMA_VALUE_EMPTY, - ECMA_ERR_MSG ("Iterator return() is not callable.")); + ECMA_ERR_MSG ("Iterator 'return' is not callable")); if (ECMA_IS_VALUE_ERROR (result)) { @@ -173,7 +173,7 @@ ecma_async_yield_throw (vm_executable_object_t *async_generator_object_p, /**< a result = ecma_async_yield_call (result, async_generator_object_p, value, - ECMA_ERR_MSG ("Iterator throw() is not callable.")); + ECMA_ERR_MSG ("Iterator 'throw' is not callable")); if (ECMA_IS_VALUE_ERROR (result)) { @@ -366,7 +366,7 @@ ecma_await_continue (vm_executable_object_t *executable_object_p, /**< executabl if (!ecma_is_value_object (value)) { ecma_free_value (value); - return ecma_raise_type_error (ECMA_ERR_MSG ("Value received by yield* is not Object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Value received by yield* is not object")); } ecma_object_t *result_obj_p = ecma_get_object_from_value (value); @@ -423,7 +423,7 @@ ecma_await_continue (vm_executable_object_t *executable_object_p, /**< executabl result = ecma_async_yield_call (result, executable_object_p, value, - ECMA_ERR_MSG ("Iterator return() is not callable.")); + ECMA_ERR_MSG ("Iterator 'return' is not callable")); ecma_free_value (value); if (ECMA_IS_VALUE_ERROR (result)) @@ -450,8 +450,8 @@ ecma_await_continue (vm_executable_object_t *executable_object_p, /**< executabl } case ECMA_AWAIT_YIELD_CLOSE: { - const char *msg_p = (ecma_is_value_object (value) ? ECMA_ERR_MSG ("Iterator throw() is not available.") - : ECMA_ERR_MSG ("Value received by yield* is not Object.")); + const char *msg_p = (ecma_is_value_object (value) ? ECMA_ERR_MSG ("Iterator 'throw' is not available") + : ECMA_ERR_MSG ("Value received by yield* is not object")); ecma_free_value (value); return ecma_raise_type_error (msg_p); @@ -465,7 +465,7 @@ ecma_await_continue (vm_executable_object_t *executable_object_p, /**< executabl if (!is_value_object && VM_GET_CONTEXT_TYPE (executable_object_p->frame_ctx.stack_top_p[-1]) != VM_CONTEXT_FINALLY_THROW) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator return() result is not object")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator 'return' result is not object")); } return ECMA_VALUE_EMPTY; } @@ -478,7 +478,7 @@ ecma_await_continue (vm_executable_object_t *executable_object_p, /**< executabl if (!ecma_is_value_object (value)) { ecma_free_value (value); - return ecma_raise_type_error (ECMA_ERR_MSG ("Value received by for-async-of is not Object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Value received by for-async-of is not object")); } ecma_object_t *result_obj_p = ecma_get_object_from_value (value); diff --git a/jerry-core/ecma/operations/ecma-container-object.c b/jerry-core/ecma/operations/ecma-container-object.c index da4713289..0981cbf49 100644 --- a/jerry-core/ecma/operations/ecma-container-object.c +++ b/jerry-core/ecma/operations/ecma-container-object.c @@ -433,7 +433,7 @@ ecma_op_container_create (const ecma_value_t *arguments_list_p, /**< arguments l if (!ecma_op_is_callable (result)) { ecma_free_value (result); - result = ecma_raise_type_error (ECMA_ERR_MSG ("add/set function is not callable.")); + result = ecma_raise_type_error (ECMA_ERR_MSG ("Function add/set is not callable")); goto cleanup_object; } @@ -486,7 +486,7 @@ ecma_op_container_create (const ecma_value_t *arguments_list_p, /**< arguments l if (!ecma_is_value_object (result)) { ecma_free_value (result); - ecma_raise_type_error (ECMA_ERR_MSG ("Iterator value is not an object.")); + ecma_raise_type_error (ECMA_ERR_MSG ("Iterator value is not an object")); result = ecma_op_iterator_close (iterator); JERRY_ASSERT (ECMA_IS_VALUE_ERROR (result)); goto cleanup_iterator; @@ -575,7 +575,7 @@ ecma_op_container_get_object (ecma_value_t this_arg, /**< this argument */ #if ENABLED (JERRY_ERROR_MESSAGES) ecma_raise_standard_error_with_format (ECMA_ERROR_TYPE, - "Expected a % object.", + "Expected a % object", ecma_make_string_value (ecma_get_magic_string (lit_id))); #else /* !ENABLED (JERRY_ERROR_MESSAGES) */ ecma_raise_type_error (NULL); @@ -797,7 +797,7 @@ ecma_op_container_foreach (ecma_extended_object_t *map_object_p, /**< map object { if (!ecma_op_is_callable (predicate)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Callback function is not callable.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Callback function is not callable")); } JERRY_ASSERT (ecma_is_value_object (predicate)); @@ -1057,7 +1057,7 @@ ecma_op_container_iterator_next (ecma_value_t this_val, /**< this argument */ { if (!ecma_is_value_object (this_val)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object")); } ecma_object_t *obj_p = ecma_get_object_from_value (this_val); @@ -1066,7 +1066,7 @@ ecma_op_container_iterator_next (ecma_value_t this_val, /**< this argument */ if (ecma_get_object_type (obj_p) != ECMA_OBJECT_TYPE_PSEUDO_ARRAY || ext_obj_p->u.pseudo_array.type != iterator_type) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an iterator.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an iterator")); } ecma_value_t iterated_value = ext_obj_p->u.pseudo_array.u2.iterated_value; diff --git a/jerry-core/ecma/operations/ecma-conversion.c b/jerry-core/ecma/operations/ecma-conversion.c index bec94f76f..39f0388ce 100644 --- a/jerry-core/ecma/operations/ecma-conversion.c +++ b/jerry-core/ecma/operations/ecma-conversion.c @@ -59,7 +59,7 @@ ecma_op_require_object_coercible (ecma_value_t value) /**< ecma value */ if (ecma_is_value_undefined (value) || ecma_is_value_null (value)) { - ecma_raise_type_error (ECMA_ERR_MSG ("Argument cannot be converted to an object.")); + ecma_raise_type_error (ECMA_ERR_MSG ("Argument cannot be converted to an object")); return false; } @@ -344,7 +344,7 @@ ecma_op_to_numeric (ecma_value_t value, /**< ecma value */ #if ENABLED (JERRY_ESNEXT) if (ecma_is_value_symbol (value)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Cannot convert a Symbol value to a number.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Cannot convert a Symbol value to a number")); } #endif /* ENABLED (JERRY_ESNEXT) */ @@ -441,7 +441,7 @@ ecma_op_to_string (ecma_value_t value) /**< ecma value */ #if ENABLED (JERRY_ESNEXT) if (ecma_is_value_symbol (value)) { - ecma_raise_type_error (ECMA_ERR_MSG ("Cannot convert a Symbol value to a string.")); + ecma_raise_type_error (ECMA_ERR_MSG ("Cannot convert a Symbol value to a string")); return NULL; } #endif /* ENABLED (JERRY_ESNEXT) */ @@ -570,7 +570,7 @@ ecma_op_to_object (ecma_value_t value) /**< ecma value */ if (ecma_is_value_undefined (value) || ecma_is_value_null (value)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument cannot be converted to an object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument cannot be converted to an object")); } else { @@ -728,7 +728,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */ /* 1. */ if (!ecma_is_value_object (obj_value)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Expected an object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Expected an object")); } ecma_object_t *obj_p = ecma_get_object_from_value (obj_value); @@ -825,7 +825,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */ && !ecma_is_value_undefined (get_prop_value)) { ecma_free_value (get_prop_value); - ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Expected a function.")); + ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Expected a function")); goto free_desc; } @@ -863,7 +863,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */ && !ecma_is_value_undefined (set_prop_value)) { ecma_free_value (set_prop_value); - ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Expected a function.")); + ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Expected a function")); goto free_desc; } @@ -890,7 +890,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */ if ((prop_desc.flags & (ECMA_PROP_IS_VALUE_DEFINED | ECMA_PROP_IS_WRITABLE_DEFINED)) && (prop_desc.flags & (ECMA_PROP_IS_GET_DEFINED | ECMA_PROP_IS_SET_DEFINED))) { - ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Accessors cannot be writable.")); + ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Accessors cannot be writable")); } else { @@ -1105,7 +1105,7 @@ ecma_op_create_list_from_array_like (ecma_value_t arr, /**< array value */ /* 3. */ if (!ecma_is_value_object (arr)) { - ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an Object.")); + ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not an object")); return NULL; } ecma_object_t *obj_p = ecma_get_object_from_value (arr); @@ -1135,7 +1135,7 @@ ecma_op_create_list_from_array_like (ecma_value_t arr, /**< array value */ { ecma_free_value (next); ecma_collection_free (list_ptr); - ecma_raise_type_error (ECMA_ERR_MSG ("Property name is neither Symbol nor String.")); + ecma_raise_type_error (ECMA_ERR_MSG ("Property name is neither Symbol nor string")); return NULL; } diff --git a/jerry-core/ecma/operations/ecma-dataview-object.c b/jerry-core/ecma/operations/ecma-dataview-object.c index 582f45cb0..d5bc5de65 100644 --- a/jerry-core/ecma/operations/ecma-dataview-object.c +++ b/jerry-core/ecma/operations/ecma-dataview-object.c @@ -55,14 +55,14 @@ ecma_op_dataview_create (const ecma_value_t *arguments_list_p, /**< arguments li /* 2. */ if (!ecma_is_value_object (buffer)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument buffer is not an object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'buffer' is not an object")); } ecma_object_t *buffer_p = ecma_get_object_from_value (buffer); if (!ecma_object_class_is (buffer_p, LIT_MAGIC_STRING_ARRAY_BUFFER_UL)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Argument buffer is not an arraybuffer.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'buffer' is not an ArrayBuffer")); } /* 3. */ @@ -80,7 +80,7 @@ ecma_op_dataview_create (const ecma_value_t *arguments_list_p, /**< arguments li /* 4. */ if (ecma_arraybuffer_is_detached (buffer_p)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached")); } /* 5. */ @@ -89,7 +89,7 @@ ecma_op_dataview_create (const ecma_value_t *arguments_list_p, /**< arguments li /* 6. */ if (offset > buffer_byte_length) { - return ecma_raise_range_error (ECMA_ERR_MSG ("Start offset is outside the bounds of the buffer.")); + return ecma_raise_range_error (ECMA_ERR_MSG ("Start offset is outside the bounds of the buffer")); } /* 7. */ @@ -108,7 +108,7 @@ ecma_op_dataview_create (const ecma_value_t *arguments_list_p, /**< arguments li /* 8.b */ if (offset + byte_length_to_index > buffer_byte_length) { - return ecma_raise_range_error (ECMA_ERR_MSG ("Start offset is outside the bounds of the buffer.")); + return ecma_raise_range_error (ECMA_ERR_MSG ("Start offset is outside the bounds of the buffer")); } JERRY_ASSERT (byte_length_to_index <= UINT32_MAX); @@ -132,7 +132,7 @@ ecma_op_dataview_create (const ecma_value_t *arguments_list_p, /**< arguments li if (ecma_arraybuffer_is_detached (buffer_p)) { ecma_deref_object (prototype_obj_p); - return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached")); } /* 9. */ @@ -177,7 +177,7 @@ ecma_op_dataview_get_object (ecma_value_t this_arg) /**< this argument */ } } - ecma_raise_type_error (ECMA_ERR_MSG ("Expected a DataView object.")); + ecma_raise_type_error (ECMA_ERR_MSG ("Expected a DataView object")); return NULL; } /* ecma_op_dataview_get_object */ @@ -300,7 +300,7 @@ ecma_op_dataview_get_set_view_value (ecma_value_t view, /**< the operation's 'vi if (ecma_arraybuffer_is_detached (buffer_p)) { ecma_free_value (value_to_set); - return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached")); } /* GetViewValue 7., SetViewValue 9. */ @@ -316,7 +316,7 @@ ecma_op_dataview_get_set_view_value (ecma_value_t view, /**< the operation's 'vi if (get_index + element_size > (ecma_number_t) view_size) { ecma_free_value (value_to_set); - return ecma_raise_range_error (ECMA_ERR_MSG ("Start offset is outside the bounds of the buffer.")); + return ecma_raise_range_error (ECMA_ERR_MSG ("Start offset is outside the bounds of the buffer")); } /* GetViewValue 11., SetViewValue 13. */ diff --git a/jerry-core/ecma/operations/ecma-eval.c b/jerry-core/ecma/operations/ecma-eval.c index 0267ee2b7..54a7eeef3 100644 --- a/jerry-core/ecma/operations/ecma-eval.c +++ b/jerry-core/ecma/operations/ecma-eval.c @@ -114,7 +114,7 @@ ecma_op_eval_chars_buffer (const lit_utf8_byte_t *code_p, /**< code characters b JERRY_UNUSED (code_buffer_size); JERRY_UNUSED (parse_opts); - return ecma_raise_syntax_error (ECMA_ERR_MSG ("The parser has been disabled.")); + return ecma_raise_syntax_error (ECMA_ERR_MSG ("Source code parsing is disabled")); #endif /* ENABLED (JERRY_PARSER) */ } /* ecma_op_eval_chars_buffer */ diff --git a/jerry-core/ecma/operations/ecma-function-object.c b/jerry-core/ecma/operations/ecma-function-object.c index f901f8a3f..a5888f0af 100644 --- a/jerry-core/ecma/operations/ecma-function-object.c +++ b/jerry-core/ecma/operations/ecma-function-object.c @@ -144,7 +144,7 @@ ecma_object_check_constructor (ecma_object_t *obj_p) /**< ecma object */ if (JERRY_UNLIKELY (type < ECMA_OBJECT_TYPE_PROXY)) { - return ECMA_ERR_MSG ("Invalid type for constructor call."); + return ECMA_ERR_MSG ("Invalid type for constructor call"); } while (JERRY_UNLIKELY (type == ECMA_OBJECT_TYPE_BOUND_FUNCTION)) @@ -171,36 +171,36 @@ ecma_object_check_constructor (ecma_object_t *obj_p) /**< ecma object */ { case CBC_FUNCTION_SCRIPT: { - return "Script (global) functions cannot be invoked with 'new'."; + return "Script (global) functions cannot be invoked with 'new'"; } case CBC_FUNCTION_GENERATOR: { - return "Generator functions cannot be invoked with 'new'."; + return "Generator functions cannot be invoked with 'new'"; } case CBC_FUNCTION_ASYNC: { - return "Async functions cannot be invoked with 'new'."; + return "Async functions cannot be invoked with 'new'"; } case CBC_FUNCTION_ASYNC_GENERATOR: { - return "Async generator functions cannot be invoked with 'new'."; + return "Async generator functions cannot be invoked with 'new'"; } case CBC_FUNCTION_ACCESSOR: { - return "Accessor functions cannot be invoked with 'new'."; + return "Accessor functions cannot be invoked with 'new'"; } case CBC_FUNCTION_METHOD: { - return "Methods cannot be invoked with 'new'."; + return "Methods cannot be invoked with 'new'"; } case CBC_FUNCTION_ARROW: { - return "Arrow functions cannot be invoked with 'new'."; + return "Arrow functions cannot be invoked with 'new'"; } default: { JERRY_ASSERT (CBC_FUNCTION_GET_TYPE (byte_code_p->status_flags) == CBC_FUNCTION_ASYNC_ARROW); - return "Async arrow functions cannot be invoked with 'new'."; + return "Async arrow functions cannot be invoked with 'new'"; } } #else /* !ENABLED (JERRY_ERROR_MESSAGES) */ @@ -217,7 +217,7 @@ ecma_object_check_constructor (ecma_object_t *obj_p) /**< ecma object */ { if (ECMA_GET_SECOND_BIT_FROM_POINTER_TAG (obj_p->u2.prototype_cp) == 0) { - return ECMA_ERR_MSG ("Proxy target is not a constructor."); + return ECMA_ERR_MSG ("Proxy target is not a constructor"); } return ECMA_IS_VALID_CONSTRUCTOR; @@ -230,7 +230,7 @@ ecma_object_check_constructor (ecma_object_t *obj_p) /**< ecma object */ { if (ecma_builtin_function_is_routine (obj_p)) { - return ECMA_ERR_MSG ("Built-in routines are not constructors."); + return ECMA_ERR_MSG ("Built-in routines have no constructor"); } #if ENABLED (JERRY_ESNEXT) @@ -252,7 +252,7 @@ ecma_check_constructor (ecma_value_t value) /**< ecma object */ { if (!ecma_is_value_object (value)) { - return ECMA_ERR_MSG ("Invalid type for constructor call."); + return ECMA_ERR_MSG ("Invalid type for constructor call"); } return ecma_object_check_constructor (ecma_get_object_from_value (value)); @@ -824,7 +824,7 @@ ecma_op_function_get_function_realm (ecma_object_t *func_obj_p) /**< function ob ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) func_obj_p; if (ecma_is_value_null (proxy_obj_p->handler)) { - ecma_raise_type_error (ECMA_ERR_MSG ("Prototype from revoked Proxy is invalid.")); + ecma_raise_type_error (ECMA_ERR_MSG ("Prototype from revoked Proxy is invalid")); return NULL; } func_obj_p = ecma_get_object_from_value (proxy_obj_p->target); @@ -888,7 +888,7 @@ ecma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object * if (!ecma_is_value_object (prototype_obj_value)) { ecma_free_value (prototype_obj_value); - return ecma_raise_type_error (ECMA_ERR_MSG ("Object expected.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Object expected")); } ecma_object_t *prototype_obj_p = ecma_get_object_from_value (prototype_obj_value); @@ -959,7 +959,7 @@ ecma_op_function_get_super_constructor (ecma_object_t *func_obj_p) /**< function { ecma_deref_object (super_ctor_p); } - return ecma_raise_type_error (ECMA_ERR_MSG ("Super binding must be a constructor.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Super binding must be a constructor")); } return ecma_make_object_value (super_ctor_p); @@ -1002,7 +1002,7 @@ ecma_op_get_prototype_from_constructor (ecma_object_t *ctor_obj_p, /**< construc ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) ctor_obj_p; if (ecma_is_value_null (proxy_obj_p->handler)) { - ecma_raise_type_error (ECMA_ERR_MSG ("Prototype from revoked Proxy is invalid.")); + ecma_raise_type_error (ECMA_ERR_MSG ("Prototype from revoked Proxy is invalid")); return NULL; } } @@ -1123,7 +1123,7 @@ ecma_op_function_call_simple (ecma_object_t *func_obj_p, /**< Function object */ { if (JERRY_CONTEXT (current_new_target_p) == NULL) { - ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Class constructor cannot be invoked without 'new'.")); + ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Class constructor requires 'new'")); goto exit; } @@ -1159,7 +1159,7 @@ ecma_op_function_call_simple (ecma_object_t *func_obj_p, /**< Function object */ if (!ecma_is_value_undefined (ret_value)) { ecma_free_value (ret_value); - ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Derived constructors may only return object or undefined.")); + ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Derived constructors may only return object or undefined")); } else { diff --git a/jerry-core/ecma/operations/ecma-get-put-value.c b/jerry-core/ecma/operations/ecma-get-put-value.c index 032a86463..1f0b61603 100644 --- a/jerry-core/ecma/operations/ecma-get-put-value.c +++ b/jerry-core/ecma/operations/ecma-get-put-value.c @@ -68,7 +68,7 @@ ecma_op_get_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme if (JERRY_UNLIKELY (property_value_p->value == ECMA_VALUE_UNINITIALIZED)) { return ecma_raise_reference_error (ECMA_ERR_MSG ("Variables declared by let/const must be" - " initialized before reading their value.")); + " initialized before reading their value")); } #endif /* ENABLED (JERRY_ESNEXT) */ @@ -229,7 +229,7 @@ ecma_op_put_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme if (JERRY_UNLIKELY (property_value_p->value == ECMA_VALUE_UNINITIALIZED)) { return ecma_raise_reference_error (ECMA_ERR_MSG ("Variables declared by let/const must be" - " initialized before writing their value.")); + " initialized before writing their value")); } #endif /* ENABLED (JERRY_ESNEXT) */ @@ -241,15 +241,15 @@ ecma_op_put_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme if (JERRY_UNLIKELY (ECMA_PROPERTY_VALUE_PTR (property_p)->value == ECMA_VALUE_UNINITIALIZED)) { return ecma_raise_reference_error (ECMA_ERR_MSG ("Variables declared by let/const must be" - " initialized before writing their value.")); + " initialized before writing their value")); } - return ecma_raise_type_error (ECMA_ERR_MSG ("Constant bindings cannot be reassigned.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Constant bindings cannot be reassigned")); } #endif /* ENABLED (JERRY_ESNEXT) */ else if (is_strict) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Binding cannot be set.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Binding cannot be set")); } return ECMA_VALUE_EMPTY; } diff --git a/jerry-core/ecma/operations/ecma-iterator-object.c b/jerry-core/ecma/operations/ecma-iterator-object.c index 398b78913..c8c89de26 100644 --- a/jerry-core/ecma/operations/ecma-iterator-object.c +++ b/jerry-core/ecma/operations/ecma-iterator-object.c @@ -239,7 +239,7 @@ ecma_op_get_iterator (ecma_value_t value, /**< value to get iterator from */ if (!ecma_is_value_object (iterator)) { ecma_free_value (iterator); - return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator is not an object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator is not an object")); } if (next_method_p != NULL) @@ -297,7 +297,7 @@ ecma_op_iterator_next_old (ecma_value_t iterator, /**< iterator value */ if (!ecma_is_value_object (func_next) || !ecma_op_is_callable (func_next)) { ecma_free_value (func_next); - return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator next() is not callable.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator 'next' is not callable")); } ecma_object_t *next_obj_p = ecma_get_object_from_value (func_next); @@ -341,7 +341,7 @@ ecma_op_iterator_next (ecma_value_t iterator, /**< iterator value */ /* 1 - 2. */ if (next_method == ECMA_VALUE_UNDEFINED) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator next() is not callable.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator 'next' is not callable")); } ecma_object_t *next_method_obj_p = ecma_get_object_from_value (next_method); @@ -389,7 +389,7 @@ ecma_op_iterator_return (ecma_value_t iterator, /**< iterator value */ if (!ecma_is_value_object (func_return) || !ecma_op_is_callable (func_return)) { ecma_free_value (func_return); - return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator return() is not callable.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator 'return' is not callable")); } ecma_object_t *return_obj_p = ecma_get_object_from_value (func_return); @@ -435,13 +435,13 @@ ecma_op_iterator_throw (ecma_value_t iterator, /**< iterator value */ } ecma_free_value (result); - return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator throw() is not available.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator 'throw' is not available")); } if (!ecma_is_value_object (func_throw) || !ecma_op_is_callable (func_throw)) { ecma_free_value (func_throw); - return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator throw() is not callable.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator 'throw' is not callable")); } ecma_object_t *return_obj_p = ecma_get_object_from_value (func_throw); @@ -553,7 +553,7 @@ ecma_op_iterator_close (ecma_value_t iterator) /**< iterator value */ if (!is_object) { ecma_free_value (completion); - return ecma_raise_type_error (ECMA_ERR_MSG ("method 'return' is not callable.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("method 'return' is not callable")); } /* 10. */ @@ -602,7 +602,7 @@ ecma_op_iterator_step (ecma_value_t iterator, /**< iterator value */ if (!ecma_is_value_object (result)) { ecma_free_value (result); - return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator result is not an object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator result is not an object")); } /* 3. */ @@ -670,7 +670,7 @@ ecma_op_iterator_do (ecma_iterator_command_type_t command, /**< command to be ex if (!ecma_is_value_object (result)) { ecma_free_value (result); - return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator result is not an object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator result is not an object")); } ecma_object_t *obj_p = ecma_get_object_from_value (result); diff --git a/jerry-core/ecma/operations/ecma-lex-env.c b/jerry-core/ecma/operations/ecma-lex-env.c index 425c9c55c..5365c5743 100644 --- a/jerry-core/ecma/operations/ecma-lex-env.c +++ b/jerry-core/ecma/operations/ecma-lex-env.c @@ -264,12 +264,12 @@ ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment #if ENABLED (JERRY_ESNEXT) else if (ecma_is_property_enumerable (*property_p)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Constant bindings cannot be reassigned.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Constant bindings cannot be reassigned")); } #endif /* ENABLED (JERRY_ESNEXT) */ else if (is_strict) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Binding cannot be set.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Binding cannot be set")); } } else @@ -334,7 +334,7 @@ ecma_op_get_binding_value (ecma_object_t *lex_env_p, /**< lexical environment */ { if (is_strict) { - result = ecma_raise_reference_error (ECMA_ERR_MSG ("Binding does not exist or is uninitialised.")); + result = ecma_raise_reference_error (ECMA_ERR_MSG ("Binding does not exist or is uninitialised")); } else { @@ -591,7 +591,7 @@ ecma_op_get_this_binding (ecma_object_t *lex_env_p) /**< lexical environment */ if (this_value == ECMA_VALUE_UNINITIALIZED) { return ecma_raise_reference_error (ECMA_ERR_MSG ("Must call super constructor in derived class before " - "accessing 'this' or returning from it.")); + "accessing 'this' or returning from it")); } ecma_ref_object (ecma_get_object_from_value (this_value)); diff --git a/jerry-core/ecma/operations/ecma-objects-general.c b/jerry-core/ecma/operations/ecma-objects-general.c index bbc7f7a35..68ee54ba1 100644 --- a/jerry-core/ecma/operations/ecma-objects-general.c +++ b/jerry-core/ecma/operations/ecma-objects-general.c @@ -42,7 +42,7 @@ ecma_reject (bool is_throw) /**< Throw flag */ { if (is_throw) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Invalid argument type.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Invalid argument type")); } else { @@ -145,7 +145,7 @@ ecma_op_general_object_delete (ecma_object_t *obj_p, /**< the object */ /* 4. */ if (is_throw) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Expected a configurable property.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Expected a configurable property")); } /* 5. */ @@ -230,7 +230,7 @@ ecma_op_general_object_default_value (ecma_object_t *obj_p, /**< the object */ ecma_free_value (result); - return ecma_raise_type_error (ECMA_ERR_MSG ("Invalid argument type in [[DefaultValue]].")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Result of [[DefaultValue]] is invalid")); } ecma_free_value (exotic_to_prim); @@ -306,7 +306,7 @@ ecma_op_general_object_ordinary_value (ecma_object_t *obj_p, /**< the object */ ecma_free_value (call_completion); } - return ecma_raise_type_error (ECMA_ERR_MSG ("Invalid argument type in [[DefaultValue]].")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Result of [[DefaultValue]] is invalid")); } /* ecma_op_general_object_ordinary_value */ /** diff --git a/jerry-core/ecma/operations/ecma-objects.c b/jerry-core/ecma/operations/ecma-objects.c index 40bebf508..2daab2bc4 100644 --- a/jerry-core/ecma/operations/ecma-objects.c +++ b/jerry-core/ecma/operations/ecma-objects.c @@ -1002,7 +1002,7 @@ ecma_op_get_method (ecma_value_t value, /**< ecma value */ if (!ecma_op_is_callable (func)) { ecma_free_value (func); - return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator is not callable.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator is not callable")); } /* 6. */ @@ -1987,7 +1987,7 @@ ecma_op_object_has_instance (ecma_object_t *obj_p, /**< the object */ return ecma_op_function_has_instance (obj_p, value); } - return ecma_raise_type_error (ECMA_ERR_MSG ("Expected a function object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Expected a function object")); } /* ecma_op_object_has_instance */ /** @@ -3006,7 +3006,7 @@ ecma_op_species_constructor (ecma_object_t *this_value, /**< This Value */ if (!ecma_is_value_object (constructor)) { ecma_free_value (constructor); - return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor must be an Object")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor must be an object")); } ecma_object_t *ctor_object_p = ecma_get_object_from_value (constructor); @@ -3027,7 +3027,7 @@ ecma_op_species_constructor (ecma_object_t *this_value, /**< This Value */ if (!ecma_is_constructor (species)) { ecma_free_value (species); - return ecma_raise_type_error (ECMA_ERR_MSG ("Species must be a Constructor")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Species must be a constructor")); } return species; diff --git a/jerry-core/ecma/operations/ecma-promise-object.c b/jerry-core/ecma/operations/ecma-promise-object.c index 8e0b7cb31..b537d74b6 100644 --- a/jerry-core/ecma/operations/ecma-promise-object.c +++ b/jerry-core/ecma/operations/ecma-promise-object.c @@ -243,7 +243,7 @@ ecma_fulfill_promise (ecma_value_t promise, /**< promise */ if (promise == value) { - ecma_raise_type_error (ECMA_ERR_MSG ("A promise cannot be resolved with itself.")); + ecma_raise_type_error (ECMA_ERR_MSG ("A promise cannot be resolved with itself")); ecma_value_t exception = jcontext_take_exception (); ecma_reject_promise (promise, exception); ecma_free_value (exception); @@ -673,7 +673,7 @@ ecma_promise_new_capability (ecma_value_t constructor) { ecma_free_value (promise); ecma_deref_object (capability_obj_p); - ecma_raise_type_error (ECMA_ERR_MSG ("'resolve' parameter must be callable.")); + ecma_raise_type_error (ECMA_ERR_MSG ("'resolve' parameter must be callable")); return NULL; } @@ -682,7 +682,7 @@ ecma_promise_new_capability (ecma_value_t constructor) { ecma_free_value (promise); ecma_deref_object (capability_obj_p); - ecma_raise_type_error (ECMA_ERR_MSG ("'reject' parameter must be callable.")); + ecma_raise_type_error (ECMA_ERR_MSG ("'reject' parameter must be callable")); return NULL; } @@ -708,7 +708,7 @@ ecma_promise_reject_or_resolve (ecma_value_t this_arg, /**< "this" argument */ { if (!ecma_is_value_object (this_arg)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("'this' is not an object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object")); } if (is_resolve @@ -862,14 +862,14 @@ ecma_promise_then (ecma_value_t promise, /**< the promise which call 'then' */ { if (!ecma_is_value_object (promise)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("'this' is not an object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object")); } ecma_object_t *obj = ecma_get_object_from_value (promise); if (!ecma_is_promise (obj)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("'this' is not a Promise.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a Promise")); } ecma_value_t species = ecma_op_species_constructor (obj, ECMA_BUILTIN_ID_PROMISE); @@ -1053,7 +1053,7 @@ ecma_promise_finally (ecma_value_t promise, /**< the promise which call 'finally /* 2. */ if (!ecma_is_value_object (promise)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("'this' is not an object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object")); } ecma_object_t *obj = ecma_get_object_from_value (promise); diff --git a/jerry-core/ecma/operations/ecma-proxy-object.c b/jerry-core/ecma/operations/ecma-proxy-object.c index c5d299c6a..eeacc6595 100644 --- a/jerry-core/ecma/operations/ecma-proxy-object.c +++ b/jerry-core/ecma/operations/ecma-proxy-object.c @@ -54,7 +54,7 @@ ecma_proxy_create (ecma_value_t target, /**< proxy target */ /* ES11+: 1 - 2. */ if (!ecma_is_value_object (target) || !ecma_is_value_object (handler)) { - ecma_raise_type_error (ECMA_ERR_MSG ("Cannot create proxy with a non-object target or handler")); + ecma_raise_type_error (ECMA_ERR_MSG ("Cannot create Proxy with a non-object target or handler")); return NULL; } @@ -240,7 +240,7 @@ ecma_validate_proxy_object (ecma_value_t handler, /**< proxy handler */ { if (ecma_is_value_null (handler)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Handler can not be null")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Handler cannot be null")); } JERRY_ASSERT (ecma_is_value_object (handler)); @@ -305,7 +305,7 @@ ecma_proxy_object_get_prototype_of (ecma_object_t *obj_p) /**< proxy object */ { ecma_free_value (handler_proto); - return ecma_raise_type_error (ECMA_ERR_MSG ("Trap returned neither object nor null.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Trap returned neither object nor null")); } /* 11. */ @@ -342,7 +342,7 @@ ecma_proxy_object_get_prototype_of (ecma_object_t *obj_p) /**< proxy object */ ecma_free_value (handler_proto); ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Proxy target is non-extensible, but the trap did not " - "return its actual prototype.")); + "return its actual prototype")); } ecma_free_value (target_proto); @@ -447,7 +447,7 @@ ecma_proxy_object_set_prototype_of (ecma_object_t *obj_p, /**< proxy object */ if (boolean_trap_result && (target_proto != proto)) { ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Target object is non-extensible and trap " - "returned different prototype.")); + "returned different prototype")); } ecma_free_value (target_proto); @@ -534,7 +534,7 @@ ecma_proxy_object_is_extensible (ecma_object_t *obj_p) /**< proxy object */ /* 12. */ if (boolean_trap_result != target_result) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Trap result does not reflect extensibility of proxy target")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Trap result does not reflect extensibility of Proxy target")); } return ecma_make_boolean_value (boolean_trap_result); @@ -617,7 +617,7 @@ ecma_proxy_object_prevent_extensions (ecma_object_t *obj_p) /**< proxy object */ if (ecma_is_value_true (target_is_ext)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Trap result does not reflect inextensibility of proxy target")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Trap result does not reflect inextensibility of Proxy target")); } } @@ -685,7 +685,7 @@ ecma_proxy_object_get_own_property_descriptor (ecma_object_t *obj_p, /**< proxy if (!ecma_is_value_object (trap_result) && !ecma_is_value_undefined (trap_result)) { ecma_free_value (trap_result); - return ecma_raise_type_error (ECMA_ERR_MSG ("Trap is not object nor undefined.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Trap is neither an object nor undefined")); } /* 12. */ @@ -731,7 +731,7 @@ ecma_proxy_object_get_own_property_descriptor (ecma_object_t *obj_p, /**< proxy /* .f */ if (ecma_is_value_false (extensible_target)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Target not extensible.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Target not extensible")); } /* .g */ @@ -789,24 +789,21 @@ ecma_proxy_object_get_own_property_descriptor (ecma_object_t *obj_p, /**< proxy if (!is_valid) { ecma_free_property_descriptor (prop_desc_p); - return ecma_raise_type_error (ECMA_ERR_MSG ("The two descriptors are not compatible.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("The two descriptors are incompatible")); } /* 22. */ else if (!(prop_desc_p->flags & ECMA_PROP_IS_CONFIGURABLE)) { - if (!target_has_desc || target_is_configurable) - { - ecma_free_property_descriptor (prop_desc_p); - return ecma_raise_type_error (ECMA_ERR_MSG ("Not compatible.")); - } + const uint16_t mask = (ECMA_PROP_IS_WRITABLE_DEFINED | ECMA_PROP_IS_WRITABLE); - /* ES11: 17.b */ - if ((prop_desc_p->flags & (ECMA_PROP_IS_WRITABLE_DEFINED | ECMA_PROP_IS_WRITABLE)) == ECMA_PROP_IS_WRITABLE_DEFINED - && target_is_writable) + if (!target_has_desc + || target_is_configurable + || ((prop_desc_p->flags & mask) == ECMA_PROP_IS_WRITABLE_DEFINED + && target_is_writable)) { ecma_free_property_descriptor (prop_desc_p); - return ecma_raise_type_error (ECMA_ERR_MSG ("Not compatible.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("The two descriptors are incompatible")); } } return ECMA_VALUE_TRUE; @@ -1147,16 +1144,15 @@ ecma_proxy_object_get (ecma_object_t *obj_p, /**< proxy object */ && !(target_desc.flags & ECMA_PROP_IS_WRITABLE) && !ecma_op_same_value (trap_result, target_desc.value)) { - ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("given property is a read-only and non-configurable" - " data property on the proxy target")); + ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Incorrect value is returned by a Proxy 'get' trap")); } else if (!(target_desc.flags & ECMA_PROP_IS_CONFIGURABLE) && (target_desc.flags & (ECMA_PROP_IS_GET_DEFINED | ECMA_PROP_IS_SET_DEFINED)) && target_desc.get_p == NULL && !ecma_is_value_undefined (trap_result)) { - ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("given property is a non-configurable property and" - " does not have a getter function")); + ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Property of a Proxy is non-configurable and " + "does not have a getter function")); } ecma_free_property_descriptor (&target_desc); @@ -1268,16 +1264,14 @@ ecma_proxy_object_set (ecma_object_t *obj_p, /**< proxy object */ && !(target_desc.flags & ECMA_PROP_IS_WRITABLE) && !ecma_op_same_value (value, target_desc.value)) { - ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("The property exists in the proxy target as a" - " non-configurable and non-writable data property" - " with a different value.")); + ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Incorrect value is returned by a Proxy 'set' trap")); } else if (!(target_desc.flags & ECMA_PROP_IS_CONFIGURABLE) - && (target_desc.flags & (ECMA_PROP_IS_GET_DEFINED | ECMA_PROP_IS_SET_DEFINED)) - && target_desc.set_p == NULL) + && (target_desc.flags & (ECMA_PROP_IS_GET_DEFINED | ECMA_PROP_IS_SET_DEFINED)) + && target_desc.set_p == NULL) { - ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("The property exists in the proxy target as a" - " non-configurable accessor property whitout a setter.")); + ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("The property of a Proxy target is a non " + "configurable accessor without a setter")); } ecma_free_property_descriptor (&target_desc); @@ -1381,7 +1375,7 @@ ecma_proxy_object_delete_property (ecma_object_t *obj_p, /**< proxy object */ if (!(target_desc.flags & ECMA_PROP_IS_CONFIGURABLE)) { ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Trap returned truish for property which is " - "non-configurable in the proxy target.")); + "non-configurable in the proxy target")); } /* ES11: 13-14 */ ecma_value_t extensible_target = ecma_builtin_object_object_is_extensible (target_obj_p); @@ -1480,7 +1474,7 @@ ecma_proxy_check_invariants_for_own_prop_keys (ecma_collection_t *trap_result, unchecked_result_keys, &unchecked_prop_name_counter))) { - ecma_raise_type_error (ECMA_ERR_MSG ("Trap result did not include all non-configurable keys.")); + ecma_raise_type_error (ECMA_ERR_MSG ("Trap result did not include all non-configurable keys")); } /* 22. */ else if (ecma_is_value_true (extensible_target)) @@ -1492,12 +1486,12 @@ ecma_proxy_check_invariants_for_own_prop_keys (ecma_collection_t *trap_result, unchecked_result_keys, &unchecked_prop_name_counter))) { - ecma_raise_type_error (ECMA_ERR_MSG ("Trap result did not include all configurable keys.")); + ecma_raise_type_error (ECMA_ERR_MSG ("Trap result did not include all configurable keys")); } /* 24. */ else if (unchecked_result_keys->item_count != unchecked_prop_name_counter) { - ecma_raise_type_error (ECMA_ERR_MSG ("Trap returned extra keys but proxy target is non-extensible")); + ecma_raise_type_error (ECMA_ERR_MSG ("Trap returned extra keys for a non-extensible Proxy target")); } /* 25. */ else @@ -1575,7 +1569,7 @@ ecma_proxy_object_own_property_keys (ecma_object_t *obj_p) /**< proxy object */ if (ecma_collection_check_duplicated_entries (trap_result)) { ecma_collection_free (trap_result); - ecma_raise_type_error (ECMA_ERR_MSG ("Trap returned duplicate entries")); + ecma_raise_type_error (ECMA_ERR_MSG ("Trap returned with duplicated entries")); return NULL; } @@ -1790,7 +1784,7 @@ ecma_proxy_object_construct (ecma_object_t *obj_p, /**< proxy object */ { ecma_free_value (new_obj); - return ecma_raise_type_error (ECMA_ERR_MSG ("Trap returned non-object")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Trap must return with an object")); } /* 12. */ diff --git a/jerry-core/ecma/operations/ecma-reference.c b/jerry-core/ecma/operations/ecma-reference.c index 310e8e861..7cc45e37f 100644 --- a/jerry-core/ecma/operations/ecma-reference.c +++ b/jerry-core/ecma/operations/ecma-reference.c @@ -311,7 +311,7 @@ ecma_op_resolve_reference_value (ecma_object_t *lex_env_p, /**< starting lexical if (JERRY_UNLIKELY (property_value_p->value == ECMA_VALUE_UNINITIALIZED)) { return ecma_raise_reference_error (ECMA_ERR_MSG ("Variables declared by let/const must be" - " initialized before reading their value.")); + " initialized before reading their value")); } #endif /* ENABLED (JERRY_ESNEXT) */ diff --git a/jerry-core/ecma/operations/ecma-regexp-object.c b/jerry-core/ecma/operations/ecma-regexp-object.c index 637a72871..dcab07082 100644 --- a/jerry-core/ecma/operations/ecma-regexp-object.c +++ b/jerry-core/ecma/operations/ecma-regexp-object.c @@ -113,7 +113,7 @@ ecma_regexp_parse_flags (ecma_string_t *flags_str_p, /**< Input string with flag if (flag == RE_FLAG_EMPTY || (result_flags & flag) != 0) { - ret_value = ecma_raise_syntax_error (ECMA_ERR_MSG ("Invalid RegExp flags.")); + ret_value = ecma_raise_syntax_error (ECMA_ERR_MSG ("Invalid RegExp flags")); break; } @@ -1902,7 +1902,7 @@ match_found: if (ECMA_RE_STACK_LIMIT_REACHED (matched_p)) { - ret_value = ecma_raise_range_error (ECMA_ERR_MSG ("Stack limit exceeded.")); + ret_value = ecma_raise_range_error (ECMA_ERR_MSG ("Stack limit exceeded")); goto cleanup_context; } @@ -1993,7 +1993,7 @@ ecma_regexp_search_helper (ecma_value_t regexp_arg, /**< regexp argument */ /* 2. */ if (!ecma_is_value_object (regexp_arg)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("'this' is not an object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object")); } ecma_value_t result = ECMA_VALUE_ERROR; @@ -2101,7 +2101,7 @@ ecma_regexp_split_helper (ecma_value_t this_arg, /**< this value */ /* 2. */ if (!ecma_is_value_object (this_arg)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("'this' is not an object.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object")); } ecma_value_t result = ECMA_VALUE_ERROR; @@ -2483,7 +2483,7 @@ cleanup_string: if (ECMA_RE_STACK_LIMIT_REACHED (matched_p)) { - result = ecma_raise_range_error (ECMA_ERR_MSG ("Stack limit exceeded.")); + result = ecma_raise_range_error (ECMA_ERR_MSG ("Stack limit exceeded")); goto cleanup_array; } @@ -2508,7 +2508,7 @@ cleanup_string: if (ECMA_RE_STACK_LIMIT_REACHED (matched_p)) { - result = ecma_raise_range_error (ECMA_ERR_MSG ("Stack limit exceeded.")); + result = ecma_raise_range_error (ECMA_ERR_MSG ("Stack limit exceeded")); goto cleanup_array; } @@ -2703,7 +2703,7 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /** (UINT32_MAX >> element_size_shift)) { - return ecma_raise_range_error (ECMA_ERR_MSG ("Maximum typedarray size is reached.")); + return ecma_raise_range_error (ECMA_ERR_MSG ("Maximum TypedArray size is reached")); } uint32_t byte_length = array_length << element_size_shift; if (byte_length > UINT32_MAX - sizeof (ecma_extended_object_t) - JMEM_ALIGNMENT + 1) { - return ecma_raise_range_error (ECMA_ERR_MSG ("Maximum typedarray size is reached.")); + return ecma_raise_range_error (ECMA_ERR_MSG ("Maximum TypedArray size is reached")); } ecma_object_t *new_arraybuffer_p = NULL; @@ -814,7 +814,7 @@ ecma_typedarray_create_object_with_buffer (ecma_object_t *arraybuffer_p, /**< th { if (ecma_arraybuffer_is_detached (arraybuffer_p)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer has been detached")); } uint32_t expected_length = (ecma_arraybuffer_get_length (arraybuffer_p) >> element_size_shift); @@ -861,7 +861,7 @@ ecma_typedarray_create_object_with_typedarray (ecma_object_t *typedarray_p, /**< ecma_object_t *src_arraybuffer_p = ecma_typedarray_get_arraybuffer (typedarray_p); if (ecma_arraybuffer_is_detached (src_arraybuffer_p)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Invalid detached ArrayBuffer.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Invalid detached ArrayBuffer")); } ecma_value_t new_typedarray = ecma_typedarray_create_object_with_length (array_length, @@ -896,7 +896,7 @@ ecma_typedarray_create_object_with_typedarray (ecma_object_t *typedarray_p, /**< if ((ECMA_TYPEDARRAY_IS_BIGINT_TYPE (src_id) ^ ECMA_TYPEDARRAY_IS_BIGINT_TYPE (typedarray_id)) == 1) { ecma_deref_object (new_typedarray_p); - return ecma_raise_type_error (ECMA_ERR_MSG ("Incompatible typedArray types.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Incompatible TypedArray types")); } #endif /* ENABLED (JERRY_BUILTIN_BIGINT) */ @@ -967,7 +967,7 @@ ecma_op_typedarray_from_helper (ecma_value_t this_val, /**< this_arg for the abo if (index >= info_p->length) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Invalid argument type.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Invalid argument type")); } ecma_value_t set_element = setter_cb (info_p->buffer_p + (index << info_p->shift), mapped_value); @@ -1343,7 +1343,7 @@ ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg li /* 22.2.1.2 */ if (ecma_is_value_undefined (arguments_list_p[0])) { - return ecma_raise_type_error (ECMA_ERR_MSG ("length argument is undefined")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Length argument is undefined")); } ecma_number_t num; @@ -1356,7 +1356,7 @@ ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg li if (num != ((ecma_number_t) length)) { - ret = ecma_raise_range_error (ECMA_ERR_MSG ("Invalid typedarray length.")); + ret = ecma_raise_range_error (ECMA_ERR_MSG ("Invalid TypedArray length")); } else { @@ -1398,11 +1398,11 @@ ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg li if (ecma_number_is_negative (offset) || fmod (offset, (1 << element_size_shift)) != 0) { /* ES2015 22.2.1.5: 9 - 10. */ - ret = ecma_raise_range_error (ECMA_ERR_MSG ("Invalid offset.")); + ret = ecma_raise_range_error (ECMA_ERR_MSG ("Invalid offset")); } else if (ecma_arraybuffer_is_detached (arraybuffer_p)) { - ret = ecma_raise_type_error (ECMA_ERR_MSG ("Invalid detached ArrayBuffer.")); + ret = ecma_raise_type_error (ECMA_ERR_MSG ("Invalid detached ArrayBuffer")); } else { @@ -1411,13 +1411,10 @@ ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg li if (ecma_is_value_undefined (arg3)) { - if (buf_byte_length % (uint32_t) (1 << element_size_shift) != 0) + if ((buf_byte_length % (uint32_t) (1 << element_size_shift) != 0) + || (buf_byte_length < offset)) { - ret = ecma_raise_range_error (ECMA_ERR_MSG ("Invalid length.")); - } - else if (buf_byte_length < offset) - { - ret = ecma_raise_range_error (ECMA_ERR_MSG ("Invalid length.")); + ret = ecma_raise_range_error (ECMA_ERR_MSG ("Invalid length")); } else { @@ -1434,7 +1431,7 @@ ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg li if (new_length > (UINT32_MAX >> element_size_shift)) { - ret = ecma_raise_range_error (ECMA_ERR_MSG ("Maximum typedarray size is reached.")); + ret = ecma_raise_range_error (ECMA_ERR_MSG ("Maximum TypedArray size is reached")); } else { @@ -1442,7 +1439,7 @@ ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg li if (((ecma_number_t) new_byte_length + offset) > buf_byte_length) { - ret = ecma_raise_range_error (ECMA_ERR_MSG ("Invalid length.")); + ret = ecma_raise_range_error (ECMA_ERR_MSG ("Invalid length")); } } } @@ -1645,7 +1642,7 @@ ecma_typedarray_create (ecma_object_t *constructor_p, /**< constructor function if (!ecma_is_typedarray (ret_val)) { ecma_free_value (ret_val); - return ecma_raise_type_error (ECMA_ERR_MSG ("Constructed object is not TypedArray.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Constructed object is not TypedArray")); } ecma_object_t *typedarray_p = ecma_get_object_from_value (ret_val); @@ -1658,7 +1655,7 @@ ecma_typedarray_create (ecma_object_t *constructor_p, /**< constructor function if (info.length < num) { ecma_free_value (ret_val); - return ecma_raise_type_error (ECMA_ERR_MSG ("Constructed typedarray is smaller than filter call result")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Constructed TypedArray is smaller than filter call result")); } } return ret_val; @@ -1710,7 +1707,7 @@ ecma_typedarray_species_create (ecma_value_t this_arg, /**< this argument */ if (ECMA_TYPEDARRAY_IS_BIGINT_TYPE (info.id) ^ ECMA_TYPEDARRAY_IS_BIGINT_TYPE (result_info.id)) { ecma_free_value (result); - return ecma_raise_type_error (ECMA_ERR_MSG ("Source and result array does not match in [[ContentType]]")); + return ecma_raise_type_error (ECMA_ERR_MSG ("TypedArray returned by [[ContentType]] does not match source")); } #endif /* ENABLED (JERRY_BUILTIN_BIGINT) */ diff --git a/jerry-core/parser/js/js-parser-util.c b/jerry-core/parser/js/js-parser-util.c index 35d6f6b55..5e841661b 100644 --- a/jerry-core/parser/js/js-parser-util.c +++ b/jerry-core/parser/js/js-parser-util.c @@ -921,69 +921,69 @@ parser_error_to_string (parser_error_t error) /**< error code */ { case PARSER_ERR_OUT_OF_MEMORY: { - return "Out of memory."; + return "Out of memory"; } case PARSER_ERR_LITERAL_LIMIT_REACHED: { - return "Maximum number of literals reached."; + return "Maximum number of literals reached"; } case PARSER_ERR_SCOPE_STACK_LIMIT_REACHED: { - return "Maximum depth of scope stack reached."; + return "Maximum depth of scope stack reached"; } case PARSER_ERR_ARGUMENT_LIMIT_REACHED: { - return "Maximum number of function arguments reached."; + return "Maximum number of function arguments reached"; } case PARSER_ERR_STACK_LIMIT_REACHED: { - return "Maximum function stack size reached."; + return "Maximum function stack size reached"; } case PARSER_ERR_INVALID_CHARACTER: { - return "Invalid (unexpected) character."; + return "Invalid (unexpected) character"; } case PARSER_ERR_INVALID_OCTAL_DIGIT: { - return "Invalid octal digit."; + return "Invalid octal digit"; } case PARSER_ERR_INVALID_HEX_DIGIT: { - return "Invalid hexadecimal digit."; + return "Invalid hexadecimal digit"; } #if ENABLED (JERRY_ESNEXT) case PARSER_ERR_INVALID_BIN_DIGIT: { - return "Invalid binary digit."; + return "Invalid binary digit"; } #endif /* ENABLED (JERRY_ESNEXT) */ case PARSER_ERR_INVALID_ESCAPE_SEQUENCE: { - return "Invalid escape sequence."; + return "Invalid escape sequence"; } case PARSER_ERR_INVALID_UNICODE_ESCAPE_SEQUENCE: { - return "Invalid unicode escape sequence."; + return "Invalid unicode escape sequence"; } case PARSER_ERR_INVALID_IDENTIFIER_START: { - return "Character cannot be start of an identifier."; + return "Character cannot be start of an identifier"; } case PARSER_ERR_INVALID_IDENTIFIER_PART: { - return "Character cannot be part of an identifier."; + return "Character cannot be part of an identifier"; } case PARSER_ERR_INVALID_KEYWORD: { - return "Escape sequences are not allowed in keywords."; + return "Escape sequences are not allowed in keywords"; } case PARSER_ERR_INVALID_NUMBER: { - return "Invalid number."; + return "Invalid number"; } case PARSER_ERR_MISSING_EXPONENT: { - return "Missing exponent part."; + return "Missing exponent part"; } case PARSER_ERR_INVALID_UNDERSCORE_IN_NUMBER: { @@ -991,443 +991,443 @@ parser_error_to_string (parser_error_t error) /**< error code */ } case PARSER_ERR_IDENTIFIER_AFTER_NUMBER: { - return "Identifier cannot start after a number."; + return "Identifier cannot start after a number"; } #if ENABLED (JERRY_BUILTIN_BIGINT) case PARSER_ERR_INVALID_BIGINT: { - return "Number is not a valid BigInt."; + return "Number is not a valid BigInt"; } #endif /* ENABLED (JERRY_BUILTIN_BIGINT) */ case PARSER_ERR_INVALID_REGEXP: { - return "Invalid regular expression."; + return "Invalid regular expression"; } case PARSER_ERR_UNKNOWN_REGEXP_FLAG: { - return "Unknown regexp flag."; + return "Unknown regexp flag"; } case PARSER_ERR_DUPLICATED_REGEXP_FLAG: { - return "Duplicated regexp flag."; + return "Duplicated regexp flag"; } case PARSER_ERR_UNSUPPORTED_REGEXP: { - return "Regexp is not supported in the selected profile."; + return "Regexp is not supported in the selected profile"; } case PARSER_ERR_IDENTIFIER_TOO_LONG: { - return "Identifier is too long."; + return "Identifier is too long"; } case PARSER_ERR_STRING_TOO_LONG: { - return "String is too long."; + return "String is too long"; } case PARSER_ERR_NUMBER_TOO_LONG: { - return "Number is too long."; + return "Number is too long"; } case PARSER_ERR_REGEXP_TOO_LONG: { - return "Regexp is too long."; + return "Regexp is too long"; } case PARSER_ERR_UNTERMINATED_MULTILINE_COMMENT: { - return "Unterminated multiline comment."; + return "Unterminated multiline comment"; } case PARSER_ERR_UNTERMINATED_STRING: { - return "Unterminated string literal."; + return "Unterminated string literal"; } case PARSER_ERR_UNTERMINATED_REGEXP: { - return "Unterminated regexp literal."; + return "Unterminated regexp literal"; } case PARSER_ERR_NEWLINE_NOT_ALLOWED: { - return "Newline is not allowed in strings or regexps."; + return "Newline is not allowed in strings or regexps"; } case PARSER_ERR_OCTAL_NUMBER_NOT_ALLOWED: { - return "Octal numbers are not allowed in strict mode."; + return "Octal numbers are not allowed in strict mode"; } case PARSER_ERR_OCTAL_ESCAPE_NOT_ALLOWED: { - return "Octal escape sequences are not allowed in strict mode."; + return "Octal escape sequences are not allowed in strict mode"; } #if ENABLED (JERRY_ESNEXT) case PARSER_ERR_TEMPLATE_STR_OCTAL_ESCAPE: { - return "Octal escape sequences are not allowed in template strings."; + return "Octal escape sequences are not allowed in template strings"; } #endif /* ENABLED (JERRY_ESNEXT) */ case PARSER_ERR_STRICT_IDENT_NOT_ALLOWED: { - return "Identifier name is reserved in strict mode."; + return "Identifier name is reserved in strict mode"; } case PARSER_ERR_EVAL_NOT_ALLOWED: { - return "Eval is not allowed to be used here in strict mode."; + return "Eval is not allowed to be used here in strict mode"; } case PARSER_ERR_ARGUMENTS_NOT_ALLOWED: { - return "Arguments is not allowed to be used here in strict mode."; + return "Arguments is not allowed to be used here in strict mode"; } #if ENABLED (JERRY_ESNEXT) case PARSER_ERR_USE_STRICT_NOT_ALLOWED: { - return "The 'use strict' directive is not allowed for functions with non-simple arguments."; + return "The 'use strict' directive is not allowed for functions with non-simple arguments"; } case PARSER_ERR_YIELD_NOT_ALLOWED: { - return "Yield expression is not allowed here."; + return "Yield expression is not allowed here"; } case PARSER_ERR_AWAIT_NOT_ALLOWED: { - return "Await expression is not allowed here."; + return "Await expression is not allowed here"; } case PARSER_ERR_FOR_IN_OF_DECLARATION: { - return "for in-of loop variable declaration may not have an initializer."; + return "for in-of loop variable declaration may not have an initializer"; } case PARSER_ERR_FOR_AWAIT_NO_ASYNC: { - return "for-await-of is only allowed inside async functions and generators."; + return "for-await-of is only allowed inside async functions and generators"; } case PARSER_ERR_FOR_AWAIT_NO_OF: { - return "only 'of' form is allowed for for-await loops."; + return "only 'of' form is allowed for for-await loops"; } case PARSER_ERR_DUPLICATED_PROTO: { - return "Duplicate __proto__ fields are not allowed in object literals."; + return "Duplicate __proto__ fields are not allowed in object literals"; } case PARSER_ERR_INVALID_LHS_ASSIGNMENT: { - return "Invalid left-hand side in assignment."; + return "Invalid left-hand side in assignment"; } case PARSER_ERR_INVALID_LHS_POSTFIX_OP: { - return "Invalid left-hand side expression in postfix operation."; + return "Invalid left-hand side expression in postfix operation"; } case PARSER_ERR_INVALID_LHS_FOR_LOOP: { - return "Invalid left-hand-side in for-loop."; + return "Invalid left-hand-side in for-loop"; } #endif /* ENABLED (JERRY_ESNEXT) */ case PARSER_ERR_DELETE_IDENT_NOT_ALLOWED: { - return "Deleting identifier is not allowed in strict mode."; + return "Deleting identifier is not allowed in strict mode"; } case PARSER_ERR_EVAL_CANNOT_ASSIGNED: { - return "Eval cannot be assigned to in strict mode."; + return "Eval cannot be assigned to in strict mode"; } case PARSER_ERR_ARGUMENTS_CANNOT_ASSIGNED: { - return "Arguments cannot be assigned to in strict mode."; + return "Arguments cannot be assigned to in strict mode"; } case PARSER_ERR_WITH_NOT_ALLOWED: { - return "With statement not allowed in strict mode."; + return "With statement not allowed in strict mode"; } case PARSER_ERR_MULTIPLE_DEFAULTS_NOT_ALLOWED: { - return "Multiple default cases are not allowed."; + return "Multiple default cases are not allowed"; } case PARSER_ERR_DEFAULT_NOT_IN_SWITCH: { - return "Default statement must be in a switch block."; + return "Default statement must be in a switch block"; } case PARSER_ERR_CASE_NOT_IN_SWITCH: { - return "Case statement must be in a switch block."; + return "Case statement must be in a switch block"; } case PARSER_ERR_LEFT_PAREN_EXPECTED: { - return "Expected '(' token."; + return "Expected '(' token"; } case PARSER_ERR_LEFT_BRACE_EXPECTED: { - return "Expected '{' token."; + return "Expected '{' token"; } case PARSER_ERR_RIGHT_PAREN_EXPECTED: { - return "Expected ')' token."; + return "Expected ')' token"; } case PARSER_ERR_RIGHT_SQUARE_EXPECTED: { - return "Expected ']' token."; + return "Expected ']' token"; } case PARSER_ERR_COLON_EXPECTED: { - return "Expected ':' token."; + return "Expected ':' token"; } case PARSER_ERR_COLON_FOR_CONDITIONAL_EXPECTED: { - return "Expected ':' token for ?: conditional expression."; + return "Expected ':' token for ?: conditional expression"; } case PARSER_ERR_SEMICOLON_EXPECTED: { - return "Expected ';' token."; + return "Expected ';' token"; } case PARSER_ERR_IN_EXPECTED: { - return "Expected 'in' token."; + return "Expected 'in' token"; } case PARSER_ERR_WHILE_EXPECTED: { - return "While expected for do-while loop."; + return "While expected for do-while loop"; } case PARSER_ERR_CATCH_FINALLY_EXPECTED: { - return "Catch or finally block expected."; + return "Catch or finally block expected"; } case PARSER_ERR_ARRAY_ITEM_SEPARATOR_EXPECTED: { - return "Expected ',' or ']' after an array item."; + return "Expected ',' or ']' after an array item"; } case PARSER_ERR_OBJECT_ITEM_SEPARATOR_EXPECTED: { - return "Expected ',' or '}' after a property definition."; + return "Expected ',' or '}' after a property definition"; } case PARSER_ERR_IDENTIFIER_EXPECTED: { - return "Identifier expected."; + return "Identifier expected"; } case PARSER_ERR_EXPRESSION_EXPECTED: { - return "Expression expected."; + return "Expression expected"; } case PARSER_ERR_PRIMARY_EXP_EXPECTED: { - return "Primary expression expected."; + return "Primary expression expected"; } case PARSER_ERR_LEFT_HAND_SIDE_EXP_EXPECTED: { - return "Left-hand-side expression expected."; + return "Left-hand-side expression expected"; } case PARSER_ERR_STATEMENT_EXPECTED: { - return "Statement expected."; + return "Statement expected"; } case PARSER_ERR_PROPERTY_IDENTIFIER_EXPECTED: { - return "Property identifier expected."; + return "Property identifier expected"; } case PARSER_ERR_ARGUMENT_LIST_EXPECTED: { - return "Expected argument list."; + return "Expected argument list"; } case PARSER_ERR_NO_ARGUMENTS_EXPECTED: { - return "Property getters must have no arguments."; + return "Property getters must have no arguments"; } case PARSER_ERR_ONE_ARGUMENT_EXPECTED: { - return "Property setters must have one argument."; + return "Property setters must have one argument"; } case PARSER_ERR_INVALID_EXPRESSION: { - return "Invalid expression."; + return "Invalid expression"; } case PARSER_ERR_INVALID_SWITCH: { - return "Invalid switch body."; + return "Invalid switch body"; } case PARSER_ERR_INVALID_BREAK: { - return "Break statement must be inside a loop or switch."; + return "Break statement must be inside a loop or switch"; } case PARSER_ERR_INVALID_BREAK_LABEL: { - return "Labeled statement targeted by a break not found."; + return "Labeled statement targeted by a break not found"; } case PARSER_ERR_INVALID_CONTINUE: { - return "Continue statement must be inside a loop."; + return "Continue statement must be inside a loop"; } case PARSER_ERR_INVALID_CONTINUE_LABEL: { - return "Labeled statement targeted by a continue not found."; + return "Labeled statement targeted by a continue not found"; } case PARSER_ERR_INVALID_RETURN: { - return "Return statement must be inside a function body."; + return "Return statement must be inside a function body"; } case PARSER_ERR_INVALID_RIGHT_SQUARE: { - return "Unexpected '}' token."; + return "Unexpected '}' token"; } case PARSER_ERR_DUPLICATED_LABEL: { - return "Duplicated label."; + return "Duplicated label"; } case PARSER_ERR_OBJECT_PROPERTY_REDEFINED: { - return "Property of object literal redefined."; + return "Property of object literal redefined"; } case PARSER_ERR_NON_STRICT_ARG_DEFINITION: { - return "Non-strict argument definition."; + return "Non-strict argument definition"; } #if ENABLED (JERRY_ESNEXT) case PARSER_ERR_VARIABLE_REDECLARED: { - return "Local variable is redeclared."; + return "Local variable is redeclared"; } case PARSER_ERR_LEXICAL_SINGLE_STATEMENT: { - return "Lexical declaration cannot appear in a single-statement context."; + return "Lexical declaration cannot appear in a single-statement context"; } case PARSER_ERR_LABELLED_FUNC_NOT_IN_BLOCK: { - return "Labelled functions are only allowed inside blocks."; + return "Labelled functions are only allowed inside blocks"; } case PARSER_ERR_LEXICAL_LET_BINDING: { - return "Let binding cannot appear in let/const declarations."; + return "Let binding cannot appear in let/const declarations"; } case PARSER_ERR_MISSING_ASSIGN_AFTER_CONST: { - return "Value assignment is expected after a const declaration."; + return "Value assignment is expected after a const declaration"; } case PARSER_ERR_MULTIPLE_CLASS_CONSTRUCTORS: { - return "Multiple constructors are not allowed."; + return "Multiple constructors are not allowed"; } case PARSER_ERR_CLASS_CONSTRUCTOR_AS_ACCESSOR: { - return "Class constructor may not be an accessor."; + return "Class constructor may not be an accessor"; } case PARSER_ERR_INVALID_CLASS_CONSTRUCTOR: { - return "Class constructor may not be a generator or async function."; + return "Class constructor may not be a generator or async function"; } case PARSER_ERR_CLASS_STATIC_PROTOTYPE: { - return "Classes may not have a static property called 'prototype'."; + return "Classes may not have a static property called 'prototype'"; } case PARSER_ERR_UNEXPECTED_SUPER_KEYWORD: { - return "Super is not allowed to be used here."; + return "Super is not allowed to be used here"; } case PARSER_ERR_TOO_MANY_CLASS_FIELDS: { - return "Too many computed class fields are declared."; + return "Too many computed class fields are declared"; } case PARSER_ERR_ARGUMENTS_IN_CLASS_FIELD: { - return "In class field declarations 'arguments' is not allowed."; + return "In class field declarations 'arguments' is not allowed"; } case PARSER_ERR_RIGHT_BRACE_EXPECTED: { - return "Expected '}' token."; + return "Expected '}' token"; } case PARSER_ERR_OF_EXPECTED: { - return "Expected 'of' token."; + return "Expected 'of' token"; } case PARSER_ERR_ASSIGNMENT_EXPECTED: { - return "Unexpected arrow function or yield expression (parentheses around the expression may help)."; + return "Unexpected arrow function or yield expression (parentheses around the expression may help)"; } case PARSER_ERR_DUPLICATED_ARGUMENT_NAMES: { - return "Duplicated function argument names are not allowed here."; + return "Duplicated function argument names are not allowed here"; } case PARSER_ERR_INVALID_DESTRUCTURING_PATTERN: { - return "Invalid destructuring assignment target."; + return "Invalid destructuring assignment target"; } case PARSER_ERR_ILLEGAL_PROPERTY_IN_DECLARATION: { - return "Illegal property in declaration context."; + return "Illegal property in declaration context"; } case PARSER_ERR_INVALID_EXPONENTIATION: { - return "Left operand of ** operator cannot be unary expression."; + return "Left operand of ** operator cannot be unary expression"; } case PARSER_ERR_INVALID_NULLISH_COALESCING: { - return "Cannot chain nullish with logical AND or OR."; + return "Cannot chain nullish with logical AND or OR"; } case PARSER_ERR_FORMAL_PARAM_AFTER_REST_PARAMETER: { - return "Rest parameter must be the last formal parameter."; + return "Rest parameter must be the last formal parameter"; } case PARSER_ERR_SETTER_REST_PARAMETER: { - return "Setter function argument must not be a rest parameter."; + return "Setter function argument must not be a rest parameter"; } case PARSER_ERR_REST_PARAMETER_DEFAULT_INITIALIZER: { - return "Rest parameter may not have a default initializer."; + return "Rest parameter may not have a default initializer"; } case PARSER_ERR_NEW_TARGET_EXPECTED: { - return "Expected new.target expression."; + return "Expected new.target expression"; } case PARSER_ERR_NEW_TARGET_NOT_ALLOWED: { - return "new.target expression is not allowed here."; + return "new.target expression is not allowed here"; } #endif /* ENABLED (JERRY_ESNEXT) */ #if ENABLED (JERRY_MODULE_SYSTEM) case PARSER_ERR_FILE_NOT_FOUND: { - return "Requested module not found."; + return "Requested module not found"; } case PARSER_ERR_FROM_EXPECTED: { - return "Expected 'from' token."; + return "Expected 'from' token"; } case PARSER_ERR_FROM_COMMA_EXPECTED: { - return "Expected 'from' or ',' token."; + return "Expected 'from' or ',' token"; } case PARSER_ERR_AS_EXPECTED: { - return "Expected 'as' token."; + return "Expected 'as' token"; } case PARSER_ERR_STRING_EXPECTED: { - return "Expected a string literal."; + return "Expected a string literal"; } case PARSER_ERR_MODULE_UNEXPECTED: { - return "Unexpected import or export statement."; + return "Unexpected import or export statement"; } case PARSER_ERR_LEFT_BRACE_MULTIPLY_EXPECTED: { - return "Expected '{' or '*' token."; + return "Expected '{' or '*' token"; } case PARSER_ERR_LEFT_BRACE_MULTIPLY_LITERAL_EXPECTED: { - return "Expected '{' or '*' or literal token."; + return "Expected '{' or '*' or literal token"; } case PARSER_ERR_RIGHT_BRACE_COMMA_EXPECTED: { - return "Expected '}' or ',' token."; + return "Expected '}' or ',' token"; } case PARSER_ERR_DUPLICATED_EXPORT_IDENTIFIER: { - return "Duplicate exported identifier."; + return "Duplicate exported identifier"; } case PARSER_ERR_DUPLICATED_IMPORT_BINDING: { - return "Duplicated imported binding name."; + return "Duplicated imported binding name"; } case PARSER_ERR_EXPORT_NOT_DEFINED: { - return "Export not defined in module."; + return "Export not defined in module"; } #endif /* ENABLED (JERRY_MODULE_SYSTEM) */ default: { JERRY_ASSERT (error == PARSER_ERR_NO_ERROR); - return "No error."; + return "No error"; } } } /* parser_error_to_string */ diff --git a/jerry-core/parser/js/js-parser.c b/jerry-core/parser/js/js-parser.c index 94b26e3f5..a0f6a06c4 100644 --- a/jerry-core/parser/js/js-parser.c +++ b/jerry-core/parser/js/js-parser.c @@ -2904,7 +2904,7 @@ parser_parse_script (const uint8_t *arg_list_p, /**< function argument list */ JERRY_UNUSED (parse_opts); JERRY_UNUSED (resource_name); - ecma_raise_syntax_error (ECMA_ERR_MSG ("The parser has been disabled.")); + ecma_raise_syntax_error (ECMA_ERR_MSG ("Source code parsing is disabled")); return NULL; #endif /* ENABLED (JERRY_PARSER) */ } /* parser_parse_script */ diff --git a/jerry-core/parser/regexp/re-parser.c b/jerry-core/parser/regexp/re-parser.c index 54b7c1404..7e8159486 100644 --- a/jerry-core/parser/regexp/re-parser.c +++ b/jerry-core/parser/regexp/re-parser.c @@ -231,7 +231,7 @@ re_check_quantifier (re_compiler_ctx_t *re_ctx_p) if (re_ctx_p->token.qmin > re_ctx_p->token.qmax) { /* ECMA-262 v5.1 15.10.2.5 */ - return ecma_raise_syntax_error (ECMA_ERR_MSG ("quantifier error: min > max.")); + return ecma_raise_syntax_error (ECMA_ERR_MSG ("Quantifier error: min > max")); } return ECMA_VALUE_EMPTY; @@ -812,7 +812,7 @@ re_parse_next_token (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context * if (re_ctx_p->input_curr_p >= re_ctx_p->input_end_p) { - return ecma_raise_syntax_error (ECMA_ERR_MSG ("Unterminated character class.")); + return ecma_raise_syntax_error (ECMA_ERR_MSG ("Unterminated character class")); } return ECMA_VALUE_EMPTY; @@ -821,20 +821,20 @@ re_parse_next_token (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context * case LIT_CHAR_ASTERISK: case LIT_CHAR_PLUS: { - return ecma_raise_syntax_error (ECMA_ERR_MSG ("Invalid quantifier.")); + return ecma_raise_syntax_error (ECMA_ERR_MSG ("Invalid quantifier")); } case LIT_CHAR_LEFT_BRACE: { re_ctx_p->input_curr_p--; if (ecma_is_value_true (re_parse_quantifier (re_ctx_p))) { - return ecma_raise_syntax_error (ECMA_ERR_MSG ("Nothing to repeat.")); + return ecma_raise_syntax_error (ECMA_ERR_MSG ("Nothing to repeat")); } #if ENABLED (JERRY_ESNEXT) if (re_ctx_p->flags & RE_FLAG_UNICODE) { - return ecma_raise_syntax_error (ECMA_ERR_MSG ("Lone quantifier bracket.")); + return ecma_raise_syntax_error (ECMA_ERR_MSG ("Lone quantifier bracket")); } #endif /* ENABLED (JERRY_ESNEXT) */ @@ -851,7 +851,7 @@ re_parse_next_token (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context * { if (re_ctx_p->flags & RE_FLAG_UNICODE) { - return ecma_raise_syntax_error (ECMA_ERR_MSG ("Lone quantifier bracket.")); + return ecma_raise_syntax_error (ECMA_ERR_MSG ("Lone quantifier bracket")); } /* FALLTHRU */ @@ -958,7 +958,7 @@ re_parse_char_class (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context * { if (re_ctx_p->input_curr_p >= re_ctx_p->input_end_p) { - return ecma_raise_syntax_error (ECMA_ERR_MSG ("Unterminated character class.")); + return ecma_raise_syntax_error (ECMA_ERR_MSG ("Unterminated character class")); } if (*re_ctx_p->input_curr_p == LIT_CHAR_RIGHT_SQUARE) @@ -1314,7 +1314,7 @@ re_parse_alternative (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context { if (expect_eof) { - return ecma_raise_syntax_error (ECMA_ERR_MSG ("Unmatched ')'")); + return ecma_raise_syntax_error (ECMA_ERR_MSG ("Unmatched close bracket")); } if (!first_alternative) @@ -1329,7 +1329,7 @@ re_parse_alternative (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context { if (!expect_eof) { - return ecma_raise_syntax_error (ECMA_ERR_MSG ("Unexpected end of pattern.")); + return ecma_raise_syntax_error (ECMA_ERR_MSG ("Unexpected end of pattern")); } if (!first_alternative) diff --git a/jerry-core/vm/opcodes-ecma-arithmetics.c b/jerry-core/vm/opcodes-ecma-arithmetics.c index c9fad58f8..e688fe7ad 100644 --- a/jerry-core/vm/opcodes-ecma-arithmetics.c +++ b/jerry-core/vm/opcodes-ecma-arithmetics.c @@ -304,7 +304,7 @@ opfunc_unary_operation (ecma_value_t left_value, /**< left value */ if (is_plus) { - ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Unary operation plus is not allowed for BigInt numbers")); + ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Unary plus is not allowed for BigInts")); } else { diff --git a/jerry-core/vm/opcodes-ecma-relational-equality.c b/jerry-core/vm/opcodes-ecma-relational-equality.c index f310439a2..fa4dbc0c9 100644 --- a/jerry-core/vm/opcodes-ecma-relational-equality.c +++ b/jerry-core/vm/opcodes-ecma-relational-equality.c @@ -106,7 +106,7 @@ opfunc_instanceof (ecma_value_t left_value, /**< left value */ { if (!ecma_is_value_object (right_value)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Expected an object in 'instanceof' check.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Right value of 'instanceof' must be an object")); } #if ENABLED (JERRY_ESNEXT) @@ -155,7 +155,7 @@ opfunc_in (ecma_value_t left_value, /**< left value */ { if (!ecma_is_value_object (right_value)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Expected an object in 'in' check.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Right value of 'in' must be an object")); } ecma_string_t *property_name_p = ecma_op_to_property_key (left_value); diff --git a/jerry-core/vm/opcodes.c b/jerry-core/vm/opcodes.c index 3e7e92573..510350469 100644 --- a/jerry-core/vm/opcodes.c +++ b/jerry-core/vm/opcodes.c @@ -218,7 +218,7 @@ vm_op_delete_prop (ecma_value_t object, /**< base object */ #if ENABLED (JERRY_ESNEXT) if (is_strict && ecma_is_value_false (delete_op_ret)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("delete returned false in strict mode.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Operator delete returned false in strict mode")); } #endif /* ENABLED (JERRY_ESNEXT) */ @@ -1068,7 +1068,7 @@ ecma_op_implicit_constructor_handler_cb (const ecma_value_t function_obj, /**< t if (JERRY_CONTEXT (current_new_target_p) == NULL) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Class constructor cannot be invoked without 'new'.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Class constructor cannot be invoked without 'new'")); } return opfunc_init_class_fields (function_obj, this_val); @@ -1092,7 +1092,7 @@ ecma_op_implicit_constructor_handler_heritage_cb (const ecma_value_t function_ob if (JERRY_CONTEXT (current_new_target_p) == NULL) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Class constructor cannot be invoked without 'new'.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Class constructor cannot be invoked without 'new'")); } ecma_object_t *func_obj_p = ecma_get_object_from_value (function_obj); @@ -1489,7 +1489,7 @@ opfunc_form_super_reference (ecma_value_t **vm_stack_top_p, /**< current vm stac if (!ecma_op_this_binding_is_initialized (environment_record_p)) { return ecma_raise_reference_error (ECMA_ERR_MSG ("Must call super constructor in derived class before " - "accessing 'this' or returning from it.")); + "accessing 'this' or returning from it")); } } @@ -1497,7 +1497,7 @@ opfunc_form_super_reference (ecma_value_t **vm_stack_top_p, /**< current vm stac if (ECMA_IS_VALUE_ERROR (parent)) { - return ecma_raise_type_error (ECMA_ERR_MSG ("Cannot invoke nullable super method.")); + return ecma_raise_type_error (ECMA_ERR_MSG ("Cannot invoke nullable super method")); } if (!ecma_op_require_object_coercible (parent)) diff --git a/jerry-core/vm/vm-stack.c b/jerry-core/vm/vm-stack.c index f3031a865..923d4e07e 100644 --- a/jerry-core/vm/vm-stack.c +++ b/jerry-core/vm/vm-stack.c @@ -331,7 +331,7 @@ vm_stack_find_finally (vm_frame_ctx_t *frame_ctx_p, /**< frame context */ if (!ecma_is_value_object (result) || !ecma_op_is_callable (result)) { ecma_free_value (result); - result = ecma_raise_type_error (ECMA_ERR_MSG ("Iterator return() is not callable")); + result = ecma_raise_type_error (ECMA_ERR_MSG ("Iterator 'return' is not callable")); } else { @@ -378,7 +378,7 @@ vm_stack_find_finally (vm_frame_ctx_t *frame_ctx_p, /**< frame context */ if (!is_object) { - result = ecma_raise_type_error (ECMA_ERR_MSG ("Iterator return() result is not object")); + result = ecma_raise_type_error (ECMA_ERR_MSG ("Iterator 'return' result is not object")); } } } diff --git a/jerry-core/vm/vm.c b/jerry-core/vm/vm.c index d6076f514..94359624a 100644 --- a/jerry-core/vm/vm.c +++ b/jerry-core/vm/vm.c @@ -583,7 +583,7 @@ vm_super_call (vm_frame_ctx_t *frame_ctx_p) /**< frame context */ if (!ecma_is_constructor (func_value)) { - completion_value = ecma_raise_type_error (ECMA_ERR_MSG ("Class extends value is not a constructor.")); + completion_value = ecma_raise_type_error (ECMA_ERR_MSG ("Value for class heritage is not a constructor")); } else { @@ -699,7 +699,7 @@ vm_spread_operation (vm_frame_ctx_t *frame_ctx_p) /**< frame context */ if (!ecma_is_value_object (func_value) || !ecma_op_object_is_callable (ecma_get_object_from_value (func_value))) { - completion_value = ecma_raise_type_error (ECMA_ERR_MSG ("Expected a function.")); + completion_value = ecma_raise_type_error (ECMA_ERR_MSG ("Expected a function")); } else { @@ -783,7 +783,7 @@ opfunc_call (vm_frame_ctx_t *frame_ctx_p) /**< frame context */ if (!ecma_is_value_object (func_value) || !ecma_op_object_is_callable (ecma_get_object_from_value (func_value))) { - completion_value = ecma_raise_type_error (ECMA_ERR_MSG ("Expected a function.")); + completion_value = ecma_raise_type_error (ECMA_ERR_MSG ("Expected a function")); } else { @@ -1635,7 +1635,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */ if (binding_p != NULL) { - result = ecma_raise_syntax_error (ECMA_ERR_MSG ("Local variable is redeclared.")); + result = ecma_raise_syntax_error (ECMA_ERR_MSG ("Local variable is redeclared")); goto error; } @@ -1663,7 +1663,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */ if (binding_p != NULL) { - result = ecma_raise_syntax_error (ECMA_ERR_MSG ("Local variable is redeclared.")); + result = ecma_raise_syntax_error (ECMA_ERR_MSG ("Local variable is redeclared")); goto error; } @@ -1678,7 +1678,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */ if (ecma_is_value_true (result)) { - result = ecma_raise_syntax_error (ECMA_ERR_MSG ("Local variable is redeclared.")); + result = ecma_raise_syntax_error (ECMA_ERR_MSG ("Local variable is redeclared")); goto error; } @@ -1746,7 +1746,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */ } case VM_OC_THROW_CONST_ERROR: { - result = ecma_raise_type_error (ECMA_ERR_MSG ("Constant bindings cannot be reassigned.")); + result = ecma_raise_type_error (ECMA_ERR_MSG ("Constant bindings cannot be reassigned")); goto error; } case VM_OC_COPY_TO_GLOBAL: @@ -1939,7 +1939,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */ if (JERRY_UNLIKELY (ecma_compare_ecma_string_to_magic_id (prop_name_p, LIT_MAGIC_STRING_PROTOTYPE)) && !(opcode_data & VM_OC_NON_STATIC_FLAG)) { - result = ecma_raise_type_error (ECMA_ERR_MSG ("prototype property of a class is non-configurable")); + result = ecma_raise_type_error (ECMA_ERR_MSG ("Prototype property of a class is non-configurable")); goto error; } @@ -1972,7 +1972,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */ if (JERRY_UNLIKELY (ecma_compare_ecma_string_to_magic_id (prop_name_p, LIT_MAGIC_STRING_PROTOTYPE)) && !(opcode_data & VM_OC_NON_STATIC_FLAG)) { - result = ecma_raise_type_error (ECMA_ERR_MSG ("prototype property of a class is non-configurable")); + result = ecma_raise_type_error (ECMA_ERR_MSG ("Prototype property of a class is non-configurable")); goto error; } @@ -3051,7 +3051,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */ } case VM_OC_THROW_REFERENCE_ERROR: { - result = ecma_raise_reference_error (ECMA_ERR_MSG ("Undefined reference.")); + result = ecma_raise_reference_error (ECMA_ERR_MSG ("Undefined reference")); goto error; } case VM_OC_EVAL: diff --git a/tests/unit-core/test-api.c b/tests/unit-core/test-api.c index 227f725bb..9f1b2381b 100644 --- a/tests/unit-core/test-api.c +++ b/tests/unit-core/test-api.c @@ -910,7 +910,7 @@ main (void) jerry_release_value (err_str_val); jerry_release_value (parsed_code_val); TEST_ASSERT (!strcmp ((char *) err_str_buf, - "SyntaxError: Primary expression expected. [:2:10]")); + "SyntaxError: Primary expression expected [:2:10]")); const jerry_char_t file_str[] = "filename.js"; parsed_code_val = jerry_parse (file_str, @@ -929,7 +929,7 @@ main (void) jerry_release_value (err_str_val); jerry_release_value (parsed_code_val); TEST_ASSERT (!strcmp ((char *) err_str_buf, - "SyntaxError: Primary expression expected. [filename.js:2:10]")); + "SyntaxError: Primary expression expected [filename.js:2:10]")); const jerry_char_t eval_err_src[] = "eval(\"var b;\\nfor (,); \");"; parsed_code_val = jerry_parse (file_str, @@ -952,7 +952,7 @@ main (void) jerry_release_value (parsed_code_val); jerry_release_value (res); TEST_ASSERT (!strcmp ((char *) err_str_buf, - "SyntaxError: Primary expression expected. [:2:6]")); + "SyntaxError: Primary expression expected [:2:6]")); jerry_cleanup (); }