Add constant error messages (#4640)

added two new file ecma-errors.h and ecma-erros.c

it contains the most used errors messages.

JerryScript-DCO-1.0-Signed-off-by: bence gabor kis kisbg@inf.u-szeged.hu
This commit is contained in:
kisbg
2021-04-07 12:46:12 +02:00
committed by GitHub
parent d85020f709
commit 2381078e80
26 changed files with 415 additions and 229 deletions
+2
View File
@@ -132,6 +132,7 @@ set(SOURCE_CORE_FILES
debugger/debugger.c
ecma/base/ecma-alloc.c
ecma/base/ecma-gc.c
ecma/base/ecma-errors.c
ecma/base/ecma-helpers-collection.c
ecma/base/ecma-helpers-conversion.c
ecma/base/ecma-helpers-errol.c
@@ -327,6 +328,7 @@ if(ENABLE_AMALGAM)
api/jerry-snapshot.h
debugger/debugger.h
ecma/base/ecma-alloc.h
ecma/base/ecma-errors.h
ecma/base/ecma-gc.h
ecma/base/ecma-globals.h
ecma/base/ecma-helpers.h
+18 -17
View File
@@ -14,6 +14,7 @@
*/
#include "ecma-conversion.h"
#include "ecma-errors.h"
#include "ecma-exceptions.h"
#include "ecma-function-object.h"
#include "ecma-helpers.h"
@@ -155,8 +156,8 @@ 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";
globals_p->snapshot_error = jerry_create_error (JERRY_ERROR_RANGE, (const jerry_char_t *) error_message_p);
globals_p->snapshot_error = jerry_create_error (JERRY_ERROR_RANGE,
(const jerry_char_t *) ecma_error_maximum_snapshot_size);
return 0;
}
@@ -170,8 +171,8 @@ snapshot_add_compiled_code (ecma_compiled_code_t *compiled_code_p, /**< compiled
#if 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";
globals_p->snapshot_error = jerry_create_error (JERRY_ERROR_RANGE, (const jerry_char_t *) error_message_p);
globals_p->snapshot_error = jerry_create_error (JERRY_ERROR_RANGE,
(const jerry_char_t *) ecma_error_tagged_template_literals);
return 0;
}
@@ -187,7 +188,8 @@ snapshot_add_compiled_code (ecma_compiled_code_t *compiled_code_p, /**< compiled
/* Regular expression. */
if (globals_p->snapshot_buffer_write_offset + sizeof (ecma_compiled_code_t) > snapshot_buffer_size)
{
globals_p->snapshot_error = jerry_create_error (JERRY_ERROR_RANGE, error_buffer_too_small_p);
globals_p->snapshot_error = jerry_create_error (JERRY_ERROR_RANGE,
(const jerry_char_t *) error_buffer_too_small_p);
return 0;
}
@@ -208,7 +210,8 @@ snapshot_add_compiled_code (ecma_compiled_code_t *compiled_code_p, /**< compiled
buffer_p,
buffer_size))
{
globals_p->snapshot_error = jerry_create_error (JERRY_ERROR_RANGE, error_buffer_too_small_p);
globals_p->snapshot_error = jerry_create_error (JERRY_ERROR_RANGE,
(const jerry_char_t *) error_buffer_too_small_p);
/* cannot return inside ECMA_FINALIZE_UTF8_STRING */
}
@@ -243,7 +246,7 @@ snapshot_add_compiled_code (ecma_compiled_code_t *compiled_code_p, /**< compiled
compiled_code_p,
((size_t) compiled_code_p->size) << JMEM_ALIGNMENT_LOG))
{
globals_p->snapshot_error = jerry_create_error (JERRY_ERROR_RANGE, error_buffer_too_small_p);
globals_p->snapshot_error = jerry_create_error (JERRY_ERROR_RANGE, (const jerry_char_t *) error_buffer_too_small_p);
return 0;
}
@@ -340,8 +343,8 @@ 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";
globals_p->snapshot_error = jerry_create_error (JERRY_ERROR_RANGE, (const jerry_char_t *) error_message_p);
globals_p->snapshot_error = jerry_create_error (JERRY_ERROR_RANGE,
(const jerry_char_t *) ecma_error_maximum_snapshot_size);
return 0;
}
@@ -355,8 +358,8 @@ 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";
globals_p->snapshot_error = jerry_create_error (JERRY_ERROR_RANGE, (const jerry_char_t *) error_message_p);
globals_p->snapshot_error = jerry_create_error (JERRY_ERROR_RANGE,
(const jerry_char_t *) ecma_error_regular_expression_not_supported);
return 0;
}
@@ -366,8 +369,8 @@ 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";
globals_p->snapshot_error = jerry_create_error (JERRY_ERROR_RANGE, (const jerry_char_t *) error_message_p);
globals_p->snapshot_error = jerry_create_error (JERRY_ERROR_RANGE,
(const jerry_char_t *) ecma_error_snapshot_buffer_small);
return 0;
}
@@ -775,8 +778,7 @@ jerry_generate_snapshot_with_args (const jerry_char_t *source_p, /**< script sou
if ((generate_snapshot_opts & ~allowed_options) != 0
|| (options_p != NULL && (options_p->options & ~allowed_parse_options) != 0))
{
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);
return jerry_create_error (JERRY_ERROR_RANGE, (const jerry_char_t *) ecma_error_snapshot_flag_not_supported);
}
snapshot_globals_t globals;
@@ -847,9 +849,8 @@ jerry_generate_snapshot_with_args (const jerry_char_t *source_p, /**< script sou
&literals_num))
{
JERRY_ASSERT (lit_map_p == NULL);
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);
return jerry_create_error (JERRY_ERROR_COMMON, (const jerry_char_t *) ecma_error_cannot_allocate_memory_literals);
}
jerry_snapshot_set_offsets (buffer_p + (aligned_header_size / sizeof (uint32_t)),
+80 -155
View File
@@ -107,81 +107,6 @@ JERRY_STATIC_ASSERT (((NUMBER_ARITHMETIC_SUBTRACTION + ECMA_NUMBER_ARITHMETIC_OP
#error "JERRY_SNAPSHOT_EXEC must be enabled if JERRY_PARSER is disabled!"
#endif /* !JERRY_PARSER && !JERRY_SNAPSHOT_EXEC */
#if JERRY_ERROR_MESSAGES
/**
* Error message, if an argument is has an error flag
*/
static const char * const error_value_msg_p = "Argument cannot be marked as error";
/**
* Error message, if an argument has a wrong type
*/
static const char * const wrong_args_msg_p = "This type of argument is not allowed";
#if !JERRY_PARSER
/**
* Error message, if parsing is disabled
*/
static const char * const error_parser_not_supported_p = "Source code parsing is disabled";
#endif /* !JERRY_PARSER */
#if !JERRY_BUILTIN_JSON
/**
* Error message, if JSON support is disabled
*/
static const char * const error_json_not_supported_p = "JSON support is disabled";
#endif /* !JERRY_BUILTIN_JSON */
#if !JERRY_ESNEXT
/**
* Error message, if Symbol support is disabled
*/
static const char * const error_symbol_not_supported_p = "Symbol support is disabled";
#endif /* !JERRY_ESNEXT */
#if JERRY_MODULE_SYSTEM
/**
* Error message, if argument is not a module
*/
static const char * const error_not_module_p = "Argument is not a module";
#else /* !JERRY_MODULE_SYSTEM */
/**
* Error message, if Module support is disabled
*/
static const char * const error_module_not_supported_p = "Module support is disabled";
#endif /* JERRY_MODULE_SYSTEM */
#if !JERRY_BUILTIN_PROMISE
/**
* Error message, if Promise support is disabled
*/
static const char * const error_promise_not_supported_p = "Promise support is disabled";
#endif /* !JERRY_BUILTIN_PROMISE */
#if !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 /* !JERRY_BUILTIN_TYPEDARRAY */
#if !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 /* !JERRY_BUILTIN_DATAVIEW */
#if !JERRY_BUILTIN_BIGINT
/**
* Error message, if BigInt support is disabled
*/
static const char * const error_bigint_not_supported_p = "BigInt support is disabled";
#endif /* !JERRY_BUILTIN_BIGINT */
#endif /* JERRY_ERROR_MESSAGES */
/** \addtogroup jerry Jerry engine interface
* @{
*/
@@ -492,7 +417,7 @@ jerry_parse (const jerry_char_t *source_p, /**< script source */
if (options_p != NULL && (options_p->options & ~allowed_parse_options) != 0)
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
#endif /* JERRY_PARSER */
@@ -522,7 +447,7 @@ jerry_parse (const jerry_char_t *source_p, /**< script source */
#if JERRY_MODULE_SYSTEM
ecma_module_initialize_context ();
#else /* !JERRY_MODULE_SYSTEM */
return jerry_throw (ecma_raise_syntax_error (ECMA_ERR_MSG (error_module_not_supported_p)));
return jerry_throw (ecma_raise_syntax_error (ECMA_ERR_MSG (ecma_error_module_not_supported_p)));
#endif /* JERRY_MODULE_SYSTEM */
}
@@ -570,7 +495,7 @@ jerry_parse (const jerry_char_t *source_p, /**< script source */
JERRY_UNUSED (source_size);
JERRY_UNUSED (options_p);
return jerry_throw (ecma_raise_syntax_error (ECMA_ERR_MSG (error_parser_not_supported_p)));
return jerry_throw (ecma_raise_syntax_error (ECMA_ERR_MSG (ecma_error_parser_not_supported_p)));
#endif /* JERRY_PARSER */
} /* jerry_parse */
@@ -597,7 +522,7 @@ jerry_parse_function (const jerry_char_t *arg_list_p, /**< script source */
if (options_p != NULL && (options_p->options & ~allowed_parse_options) != 0)
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
#endif /* JERRY_PARSER */
@@ -658,7 +583,7 @@ jerry_parse_function (const jerry_char_t *arg_list_p, /**< script source */
JERRY_UNUSED (source_size);
JERRY_UNUSED (options_p);
return jerry_throw (ecma_raise_syntax_error (ECMA_ERR_MSG (error_parser_not_supported_p)));
return jerry_throw (ecma_raise_syntax_error (ECMA_ERR_MSG (ecma_error_parser_not_supported_p)));
#endif /* JERRY_PARSER */
} /* jerry_parse_function */
@@ -678,21 +603,21 @@ jerry_run (const jerry_value_t func_val) /**< function to run */
if (!ecma_is_value_object (func_val))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
ecma_object_t *object_p = ecma_get_object_from_value (func_val);
if (ecma_get_object_type (object_p) != ECMA_OBJECT_TYPE_CLASS)
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
if (ext_object_p->u.cls.type != ECMA_OBJECT_CLASS_SCRIPT)
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
const ecma_compiled_code_t *bytecode_data_p;
@@ -722,7 +647,7 @@ jerry_eval (const jerry_char_t *source_p, /**< source code */
if ((parse_opts & ~allowed_parse_options) != 0)
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
return jerry_return (ecma_op_eval_chars_buffer ((const lit_utf8_byte_t *) source_p,
@@ -756,7 +681,7 @@ jerry_module_link (const jerry_value_t module_val, /**< root module */
if (module_p == NULL)
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_not_module_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_not_module_p)));
}
return jerry_return (ecma_module_link (module_p, callback, user_p));
@@ -765,7 +690,7 @@ jerry_module_link (const jerry_value_t module_val, /**< root module */
JERRY_UNUSED (callback);
JERRY_UNUSED (user_p);
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_module_not_supported_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_module_not_supported_p)));
#endif /* JERRY_MODULE_SYSTEM */
} /* jerry_module_link */
@@ -788,7 +713,7 @@ jerry_module_evaluate (const jerry_value_t module_val) /**< root module */
if (module_p == NULL)
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_not_module_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_not_module_p)));
}
if (module_p->header.u.cls.u1.module_state != JERRY_MODULE_STATE_LINKED)
@@ -800,7 +725,7 @@ jerry_module_evaluate (const jerry_value_t module_val) /**< root module */
#else /* !JERRY_MODULE_SYSTEM */
JERRY_UNUSED (module_val);
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_module_not_supported_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_module_not_supported_p)));
#endif /* JERRY_MODULE_SYSTEM */
} /* jerry_module_evaluate */
@@ -888,7 +813,7 @@ jerry_module_get_request (const jerry_value_t module_val, /**< module */
if (module_p == NULL)
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_not_module_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_not_module_p)));
}
ecma_module_node_t *node_p = module_p->imports_p;
@@ -909,7 +834,7 @@ jerry_module_get_request (const jerry_value_t module_val, /**< module */
JERRY_UNUSED (module_val);
JERRY_UNUSED (request_index);
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_module_not_supported_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_module_not_supported_p)));
#endif /* JERRY_MODULE_SYSTEM */
} /* jerry_module_get_request */
@@ -932,7 +857,7 @@ jerry_module_get_namespace (const jerry_value_t module_val) /**< module */
if (module_p == NULL)
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_not_module_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_not_module_p)));
}
if (module_p->namespace_object_p == NULL)
@@ -950,7 +875,7 @@ jerry_module_get_namespace (const jerry_value_t module_val) /**< module */
#else /* !JERRY_MODULE_SYSTEM */
JERRY_UNUSED (module_val);
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_module_not_supported_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_module_not_supported_p)));
#endif /* JERRY_MODULE_SYSTEM */
} /* jerry_module_get_namespace */
@@ -1716,7 +1641,7 @@ jerry_binary_operation (jerry_binary_operation_t op, /**< operation */
if (ecma_is_value_error_reference (lhs) || ecma_is_value_error_reference (rhs))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_value_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_value_msg_p)));
}
switch (op)
@@ -1750,7 +1675,7 @@ jerry_binary_operation (jerry_binary_operation_t op, /**< operation */
if (!ecma_is_value_object (lhs)
|| !ecma_op_is_callable (rhs))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
ecma_object_t *proto_obj_p = ecma_get_object_from_value (rhs);
@@ -1980,7 +1905,7 @@ jerry_value_to_number (const jerry_value_t value) /**< input value */
if (ecma_is_value_error_reference (value))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_value_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_value_msg_p)));
}
ecma_number_t num;
@@ -2010,7 +1935,7 @@ jerry_value_to_object (const jerry_value_t value) /**< input value */
if (ecma_is_value_error_reference (value))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_value_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_value_msg_p)));
}
return jerry_return (ecma_op_to_object (value));
@@ -2032,7 +1957,7 @@ jerry_value_to_primitive (const jerry_value_t value) /**< input value */
if (ecma_is_value_error_reference (value))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_value_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_value_msg_p)));
}
return jerry_return (ecma_op_to_primitive (value, ECMA_PREFERRED_TYPE_NO));
@@ -2055,7 +1980,7 @@ jerry_value_to_string (const jerry_value_t value) /**< input value */
if (ecma_is_value_error_reference (value))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_value_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_value_msg_p)));
}
ecma_string_t *str_p = ecma_op_to_string (value);
@@ -2084,13 +2009,13 @@ jerry_value_to_bigint (const jerry_value_t value) /**< input value */
#if JERRY_BUILTIN_BIGINT
if (ecma_is_value_error_reference (value))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_value_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_value_msg_p)));
}
return jerry_return (ecma_bigint_to_bigint (value, true));
#else /* !JERRY_BUILTIN_BIGINT */
JERRY_UNUSED (value);
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_bigint_not_supported_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_bigint_not_supported_p)));
#endif /* JERRY_BUILTIN_BIGINT */
} /* jerry_value_to_bigint */
@@ -2422,7 +2347,7 @@ jerry_create_promise (void)
return promise_value;
#else /* !JERRY_BUILTIN_PROMISE */
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_promise_not_supported_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_promise_not_supported_p)));
#endif /* JERRY_BUILTIN_PROMISE */
} /* jerry_create_promise */
@@ -2443,7 +2368,7 @@ jerry_create_proxy (const jerry_value_t target, /**< target argument */
if (ecma_is_value_error_reference (target)
|| ecma_is_value_error_reference (handler))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
#if JERRY_BUILTIN_PROXY
@@ -2479,7 +2404,7 @@ jerry_create_special_proxy (const jerry_value_t target, /**< target argument */
if (ecma_is_value_error_reference (target)
|| ecma_is_value_error_reference (handler))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
#if JERRY_BUILTIN_PROXY
@@ -2613,13 +2538,13 @@ jerry_create_symbol (const jerry_value_t value) /**< api value */
if (ecma_is_value_error_reference (value))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
#if JERRY_ESNEXT
return jerry_return (ecma_op_create_symbol (&value, 1));
#else /* !JERRY_ESNEXT */
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_symbol_not_supported_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_symbol_not_supported_p)));
#endif /* JERRY_ESNEXT */
} /* jerry_create_symbol */
@@ -2642,7 +2567,7 @@ jerry_create_bigint (const uint64_t *digits_p, /**< BigInt digits (lowest digit
JERRY_UNUSED (digits_p);
JERRY_UNUSED (size);
JERRY_UNUSED (sign);
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_bigint_not_supported_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_bigint_not_supported_p)));
#endif /* JERRY_BUILTIN_BIGINT */
} /* jerry_create_bigint */
@@ -3211,7 +3136,7 @@ jerry_get_property (const jerry_value_t obj_val, /**< object value */
if (!ecma_is_value_object (obj_val)
|| !ecma_is_value_prop_name (prop_name_val))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
jerry_value_t ret_value = ecma_op_object_get (ecma_get_object_from_value (obj_val),
@@ -3236,7 +3161,7 @@ jerry_get_property_by_index (const jerry_value_t obj_val, /**< object value */
if (!ecma_is_value_object (obj_val))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
ecma_value_t ret_value = ecma_op_object_get_by_index (ecma_get_object_from_value (obj_val), index);
@@ -3271,7 +3196,7 @@ jerry_get_own_property (const jerry_value_t obj_val, /**< object value */
|| !ecma_is_value_prop_name (prop_name_val)
|| !ecma_is_value_object (receiver_val))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
ecma_object_t *object_p = ecma_get_object_from_value (obj_val);
@@ -3323,7 +3248,7 @@ jerry_get_internal_property (const jerry_value_t obj_val, /**< object value */
if (!ecma_is_value_object (obj_val)
|| !ecma_is_value_prop_name (prop_name_val))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
ecma_object_t *obj_p = ecma_get_object_from_value (obj_val);
@@ -3373,7 +3298,7 @@ jerry_set_property (const jerry_value_t obj_val, /**< object value */
|| !ecma_is_value_object (obj_val)
|| !ecma_is_value_prop_name (prop_name_val))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
return jerry_return (ecma_op_object_put (ecma_get_object_from_value (obj_val),
@@ -3401,7 +3326,7 @@ jerry_set_property_by_index (const jerry_value_t obj_val, /**< object value */
if (ecma_is_value_error_reference (value_to_set)
|| !ecma_is_value_object (obj_val))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
ecma_value_t ret_value = ecma_op_object_put_by_index (ecma_get_object_from_value (obj_val),
@@ -3574,7 +3499,7 @@ jerry_property_descriptor_to_ecma (const jerry_property_descriptor_t *prop_desc_
{
if (ecma_is_value_error_reference (prop_desc_p->value))
{
prop_desc.value = ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p));
prop_desc.value = ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p));
return prop_desc;
}
@@ -3588,7 +3513,7 @@ jerry_property_descriptor_to_ecma (const jerry_property_descriptor_t *prop_desc_
if (ecma_is_value_error_reference (getter))
{
prop_desc.value = ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p));
prop_desc.value = ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p));
return prop_desc;
}
@@ -3598,7 +3523,7 @@ jerry_property_descriptor_to_ecma (const jerry_property_descriptor_t *prop_desc_
}
else if (!ecma_is_value_null (getter))
{
prop_desc.value = ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p));
prop_desc.value = ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p));
return prop_desc;
}
}
@@ -3609,7 +3534,7 @@ jerry_property_descriptor_to_ecma (const jerry_property_descriptor_t *prop_desc_
if (ecma_is_value_error_reference (setter))
{
prop_desc.value = ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p));
prop_desc.value = ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p));
return prop_desc;
}
@@ -3619,7 +3544,7 @@ jerry_property_descriptor_to_ecma (const jerry_property_descriptor_t *prop_desc_
}
else if (!ecma_is_value_null (setter))
{
prop_desc.value = ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p));
prop_desc.value = ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p));
return prop_desc;
}
}
@@ -3632,7 +3557,7 @@ jerry_property_descriptor_to_ecma (const jerry_property_descriptor_t *prop_desc_
|| (prop_desc_p->flags & enumerable_mask) == JERRY_PROP_IS_ENUMERABLE
|| (prop_desc_p->flags & writable_mask) == JERRY_PROP_IS_WRITABLE)
{
prop_desc.value = ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p));
prop_desc.value = ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p));
return prop_desc;
}
@@ -3673,14 +3598,14 @@ jerry_define_own_property (const jerry_value_t obj_val, /**< object value */
if (!ecma_is_value_object (obj_val)
|| !ecma_is_value_prop_name (prop_name_val))
{
return jerry_error_or_false (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)),
return jerry_error_or_false (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)),
prop_desc_p->flags & JERRY_PROP_SHOULD_THROW);
}
if (prop_desc_p->flags & (JERRY_PROP_IS_WRITABLE_DEFINED | JERRY_PROP_IS_VALUE_DEFINED)
&& prop_desc_p->flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED))
{
return jerry_error_or_false (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)),
return jerry_error_or_false (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)),
prop_desc_p->flags & JERRY_PROP_SHOULD_THROW);
}
@@ -3823,14 +3748,14 @@ jerry_invoke_function (bool is_invoke_as_constructor, /**< true - invoke functio
if (ecma_is_value_error_reference (func_obj_val)
|| ecma_is_value_error_reference (this_val))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_value_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_value_msg_p)));
}
for (uint32_t i = 0; i < args_count; i++)
{
if (ecma_is_value_error_reference (args_p[i]))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_value_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_value_msg_p)));
}
}
@@ -3877,14 +3802,14 @@ jerry_call_function (const jerry_value_t func_obj_val, /**< function object to c
{
if (ecma_is_value_error_reference (args_p[i]))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_value_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_value_msg_p)));
}
}
return jerry_invoke_function (false, func_obj_val, this_val, args_p, args_count);
}
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
} /* jerry_call_function */
/**
@@ -3910,7 +3835,7 @@ jerry_construct_object (const jerry_value_t func_obj_val, /**< function object t
{
if (ecma_is_value_error_reference (args_p[i]))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_value_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_value_msg_p)));
}
}
@@ -3918,7 +3843,7 @@ jerry_construct_object (const jerry_value_t func_obj_val, /**< function object t
return jerry_invoke_function (true, func_obj_val, this_val, args_p, args_count);
}
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
} /* jerry_construct_object */
/**
@@ -3937,7 +3862,7 @@ jerry_get_object_keys (const jerry_value_t obj_val) /**< object value */
if (!ecma_is_value_object (obj_val))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
ecma_collection_t *prop_names = ecma_op_object_get_enumerable_property_names (ecma_get_object_from_value (obj_val),
@@ -3969,7 +3894,7 @@ jerry_get_prototype (const jerry_value_t obj_val) /**< object value */
if (!ecma_is_value_object (obj_val))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
ecma_object_t *obj_p = ecma_get_object_from_value (obj_val);
@@ -4008,7 +3933,7 @@ jerry_set_prototype (const jerry_value_t obj_val, /**< object value */
|| ecma_is_value_error_reference (proto_obj_val)
|| (!ecma_is_value_object (proto_obj_val) && !ecma_is_value_null (proto_obj_val)))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
ecma_object_t *obj_p = ecma_get_object_from_value (obj_val);
@@ -4306,7 +4231,7 @@ jerry_object_get_property_names (const jerry_value_t obj_val, /**< object */
if (!ecma_is_value_object (obj_val))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
ecma_object_t *obj_p = ecma_get_object_from_value (obj_val);
@@ -4537,12 +4462,12 @@ jerry_resolve_or_reject_promise (jerry_value_t promise, /**< the promise value *
#if JERRY_BUILTIN_PROMISE
if (!ecma_is_value_object (promise) || !ecma_is_promise (ecma_get_object_from_value (promise)))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
if (ecma_is_value_error_reference (argument))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_value_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_value_msg_p)));
}
if (is_resolve)
@@ -4556,7 +4481,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 (error_promise_not_supported_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_promise_not_supported_p)));
#endif /* JERRY_BUILTIN_PROMISE */
} /* jerry_resolve_or_reject_promise */
@@ -4574,13 +4499,13 @@ jerry_get_promise_result (const jerry_value_t promise) /**< promise object to ge
#if JERRY_BUILTIN_PROMISE
if (!jerry_value_is_promise (promise))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
return ecma_promise_get_result (ecma_get_object_from_value (promise));
#else /* !JERRY_BUILTIN_PROMISE */
JERRY_UNUSED (promise);
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_promise_not_supported_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_promise_not_supported_p)));
#endif /* JERRY_BUILTIN_PROMISE */
} /* jerry_get_promise_result */
@@ -4688,7 +4613,7 @@ jerry_get_symbol_description (const jerry_value_t symbol) /**< symbol value */
#if JERRY_ESNEXT
if (!ecma_is_value_symbol (symbol))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
/* Note: This operation cannot throw an error */
@@ -4696,7 +4621,7 @@ jerry_get_symbol_description (const jerry_value_t symbol) /**< symbol value */
#else /* !JERRY_ESNEXT */
JERRY_UNUSED (symbol);
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_symbol_not_supported_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_symbol_not_supported_p)));
#endif /* JERRY_ESNEXT */
} /* jerry_get_symbol_description */
@@ -4717,7 +4642,7 @@ jerry_get_symbol_descriptive_string (const jerry_value_t symbol) /**< symbol val
#if JERRY_ESNEXT
if (!ecma_is_value_symbol (symbol))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
/* Note: This operation cannot throw an error */
@@ -4725,7 +4650,7 @@ jerry_get_symbol_descriptive_string (const jerry_value_t symbol) /**< symbol val
#else /* !JERRY_ESNEXT */
JERRY_UNUSED (symbol);
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_symbol_not_supported_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_symbol_not_supported_p)));
#endif /* JERRY_ESNEXT */
} /** jerry_get_symbol_descriptive_string */
@@ -5290,7 +5215,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 /* !JERRY_BUILTIN_TYPEDARRAY */
JERRY_UNUSED (size);
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_typed_array_not_supported_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_typed_array_not_supported_p)));
#endif /* JERRY_BUILTIN_TYPEDARRAY */
} /* jerry_create_arraybuffer */
@@ -5331,7 +5256,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 (error_typed_array_not_supported_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_typed_array_not_supported_p)));
#endif /* JERRY_BUILTIN_TYPEDARRAY */
} /* jerry_create_arraybuffer_external */
@@ -5569,7 +5494,7 @@ jerry_create_dataview (const jerry_value_t array_buffer, /**< arraybuffer to cre
#if JERRY_BUILTIN_DATAVIEW
if (ecma_is_value_error_reference (array_buffer))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
ecma_value_t arguments_p[3] =
@@ -5591,7 +5516,7 @@ 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 (error_data_view_not_supported_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_data_view_not_supported_p)));
#endif /* JERRY_BUILTIN_DATAVIEW */
} /* jerry_create_dataview */
@@ -5636,7 +5561,7 @@ jerry_get_dataview_buffer (const jerry_value_t value, /**< DataView to get the a
#if JERRY_BUILTIN_DATAVIEW
if (ecma_is_value_error_reference (value))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (wrong_args_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
ecma_dataview_object_t *dataview_p = ecma_op_dataview_get_object (value);
@@ -5664,7 +5589,7 @@ 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 (error_data_view_not_supported_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_data_view_not_supported_p)));
#endif /* JERRY_BUILTIN_DATAVIEW */
} /* jerry_get_dataview_buffer */
@@ -5803,7 +5728,7 @@ jerry_create_typedarray (jerry_typedarray_type_t type_name, /**< type of TypedAr
#else /* !JERRY_BUILTIN_TYPEDARRAY */
JERRY_UNUSED (type_name);
JERRY_UNUSED (length);
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_typed_array_not_supported_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_typed_array_not_supported_p)));
#endif /* JERRY_BUILTIN_TYPEDARRAY */
} /* jerry_create_typedarray */
@@ -5827,7 +5752,7 @@ jerry_create_typedarray_for_arraybuffer_sz (jerry_typedarray_type_t type_name, /
#if JERRY_BUILTIN_TYPEDARRAY
if (ecma_is_value_error_reference (arraybuffer))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_value_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_value_msg_p)));
}
ecma_builtin_id_t prototype_id = 0;
@@ -5862,7 +5787,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 (error_typed_array_not_supported_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_typed_array_not_supported_p)));
#endif /* JERRY_BUILTIN_TYPEDARRAY */
} /* jerry_create_typedarray_for_arraybuffer_sz */
@@ -5884,7 +5809,7 @@ jerry_create_typedarray_for_arraybuffer (jerry_typedarray_type_t type_name, /**<
#if JERRY_BUILTIN_TYPEDARRAY
if (ecma_is_value_error_reference (arraybuffer))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_value_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_value_msg_p)));
}
jerry_length_t byteLength = jerry_get_arraybuffer_byte_length (arraybuffer);
@@ -5892,7 +5817,7 @@ jerry_create_typedarray_for_arraybuffer (jerry_typedarray_type_t type_name, /**<
#else /* !JERRY_BUILTIN_TYPEDARRAY */
JERRY_UNUSED (type_name);
JERRY_UNUSED (arraybuffer);
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_typed_array_not_supported_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_typed_array_not_supported_p)));
#endif /* JERRY_BUILTIN_TYPEDARRAY */
} /* jerry_create_typedarray_for_arraybuffer */
@@ -5998,7 +5923,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 (error_typed_array_not_supported_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_typed_array_not_supported_p)));
#endif /* JERRY_BUILTIN_TYPEDARRAY */
} /* jerry_get_typedarray_buffer */
@@ -6032,7 +5957,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 (error_json_not_supported_p)));
return jerry_throw (ecma_raise_syntax_error (ECMA_ERR_MSG (ecma_error_json_not_supported_p)));
#endif /* JERRY_BUILTIN_JSON */
} /* jerry_json_parse */
@@ -6054,7 +5979,7 @@ jerry_json_stringify (const jerry_value_t input_value) /**< a value to stringify
#if JERRY_BUILTIN_JSON
if (ecma_is_value_error_reference (input_value))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_value_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_value_msg_p)));
}
ecma_value_t ret_value = ecma_builtin_json_stringify_no_opts (input_value);
@@ -6068,7 +5993,7 @@ jerry_json_stringify (const jerry_value_t input_value) /**< a value to stringify
#else /* JERRY_BUILTIN_JSON */
JERRY_UNUSED (input_value);
return jerry_throw (ecma_raise_syntax_error (ECMA_ERR_MSG (error_json_not_supported_p)));
return jerry_throw (ecma_raise_syntax_error (ECMA_ERR_MSG (ecma_error_json_not_supported_p)));
#endif /* JERRY_BUILTIN_JSON */
} /* jerry_json_stringify */
@@ -6093,7 +6018,7 @@ jerry_create_container (jerry_container_type_t container_type, /**< Type of the
{
if (ecma_is_value_error_reference (arguments_list_p[i]))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (error_value_msg_p)));
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_value_msg_p)));
}
}
+180
View File
@@ -0,0 +1,180 @@
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "ecma-errors.h"
#if JERRY_ERROR_MESSAGES
/**
* Error message, if an argument is has an error flag
*/
const char * const ecma_error_value_msg_p = "Argument cannot be marked as error";
/**
* Error message, if an argument has a wrong type
*/
const char * const ecma_error_wrong_args_msg_p = "This type of argument is not allowed";
#if !JERRY_PARSER
/**
* Error message, if parsing is disabled
*/
const char * const ecma_error_parser_not_supported_p = "Source code parsing is disabled";
#endif /* !JERRY_PARSER */
#if !JERRY_BUILTIN_JSON
/**
* Error message, if JSON support is disabled
*/
const char * const ecma_error_json_not_supported_p = "JSON support is disabled";
#endif /* !JERRY_BUILTIN_JSON */
#if !JERRY_ESNEXT
/**
* Error message, if Symbol support is disabled
*/
const char * const ecma_error_symbol_not_supported_p = "Symbol support is disabled";
#endif /* !JERRY_ESNEXT */
#if !JERRY_BUILTIN_PROMISE
/**
* Error message, if Promise support is disabled
*/
const char * const ecma_error_promise_not_supported_p = "Promise support is disabled";
#endif /* !JERRY_BUILTIN_PROMISE */
#if !JERRY_BUILTIN_TYPEDARRAY
/**
* Error message, if TypedArray support is disabled
*/
const char * const ecma_error_typed_array_not_supported_p = "TypedArray support is disabled";
#endif /* !JERRY_BUILTIN_TYPEDARRAY */
#if !JERRY_BUILTIN_DATAVIEW
/**
* Error message, if DataView support is disabled
*/
const char * const ecma_error_data_view_not_supported_p = "DataView support is disabled";
#endif /* !JERRY_BUILTIN_DATAVIEW */
#if !JERRY_BUILTIN_BIGINT
/**
* Error message, if BigInt support is disabled
*/
const char * const ecma_error_bigint_not_supported_p = "BigInt support is disabled";
#endif /* !JERRY_BUILTIN_BIGINT */
#if JERRY_MODULE_SYSTEM
/**
* Error message, if argument is not a module
*/
const char * const ecma_error_not_module_p = "Argument is not a module";
#else /* !JERRY_MODULE_SYSTEM */
/**
* Error message, if Module support is disabled
*/
const char * const ecma_error_module_not_supported_p = "Module support is disabled";
#endif /* JERRY_MODULE_SYSTEM */
/**
* Error message, if callback function is not callable
*/
const char * const ecma_error_callback_is_not_callable = "Callback function is not callable";
/**
* Error message, if arrayBuffer is detached
*/
const char * const ecma_error_arraybuffer_is_detached = "ArrayBuffer has been detached";
/**
* Error message, cannot convert undefined or null to object
*/
const char * const ecma_error_cannot_convert_to_object = "Cannot convert undefined or null to object";
/**
* Error message, prototype property of a class is non-configurable
*/
const char * const ecma_error_class_is_non_configurable = "Prototype property of a class is non-configurable";
/**
* Error message, argument is not an object
*/
const char * const ecma_error_argument_is_not_an_object = "Argument is not an object";
/**
* Error message, target is not a constructor
*/
const char * const ecma_error_target_is_not_a_constructor = "Target is not a constructor";
/**
* Error message, argument is not an regexp
*/
const char * const ecma_error_argument_is_not_an_regexp = "Argument 'this' is not a RegExp object";
/**
* Error message, invalid array length
*/
const char * const ecma_error_invalid_array_length = "Invalid Array length";
/**
* Error message, local variable is redeclared
*/
const char * const ecma_error_local_variable_is_redeclared = "Local variable is redeclared";
/**
* Error message, expected a function
*/
const char * const ecma_error_expected_a_function = "Expected a function";
/**
* Error message, class constructor invoked without new keyword
*/
const char * const ecma_error_class_constructor_new = "Class constructor cannot be invoked without 'new'";
#endif /* JERRY_ERROR_MESSAGES */
#if JERRY_SNAPSHOT_SAVE || JERRY_SNAPSHOT_EXEC
/**
* Error message, maximum snapshot size reached
*/
const char * const ecma_error_maximum_snapshot_size = "Maximum snapshot size reached";
/**
* Error message, regular expressions literals are not supported
*/
const char * const ecma_error_regular_expression_not_supported = "Regular expression literals are not supported";
/**
* Error message, snapshot buffer too small
*/
const char * const ecma_error_snapshot_buffer_small = "Snapshot buffer too small";
/**
* Error message, Unsupported generate snapshot flags specified
*/
const char * const ecma_error_snapshot_flag_not_supported = "Unsupported generate snapshot flags specified";
/**
* Error message, Cannot allocate memory for literals
*/
const char * const ecma_error_cannot_allocate_memory_literals = "Cannot allocate memory for literals";
/**
* Error message, Unsupported feature: tagged template literals
*/
const char * const ecma_error_tagged_template_literals = "Unsupported feature: tagged template literals";
#endif /* JERRY_SNAPSHOT_SAVE || JERRY_SNAPSHOT_EXEC */
+77
View File
@@ -0,0 +1,77 @@
/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "config.h"
#ifndef ECMA_ERRORS_H
#define ECMA_ERRORS_H
extern const char * const ecma_error_value_msg_p;
extern const char * const ecma_error_wrong_args_msg_p;
#if !JERRY_PARSER
extern const char * const ecma_error_parser_not_supported_p;
#endif /* !JERRY_PARSER */
#if !JERRY_BUILTIN_JSON
extern const char * const ecma_error_json_not_supported_p;
#endif /* !JERRY_BUILTIN_JSON */
#if !JERRY_ESNEXT
extern const char * const ecma_error_symbol_not_supported_p;
#endif /* !JERRY_ESNEXT */
#if !JERRY_BUILTIN_PROMISE
extern const char * const ecma_error_promise_not_supported_p;
#endif /* !JERRY_BUILTIN_PROMISE */
#if !JERRY_BUILTIN_TYPEDARRAY
extern const char * const ecma_error_typed_array_not_supported_p;
#endif /* !JERRY_BUILTIN_TYPEDARRAY */
#if !JERRY_BUILTIN_DATAVIEW
extern const char * const ecma_error_data_view_not_supported_p;
#endif /* !JERRY_BUILTIN_DATAVIEW */
#if !JERRY_BUILTIN_BIGINT
extern const char * const ecma_error_bigint_not_supported_p;
#endif /* !JERRY_BUILTIN_BIGINT */
#if JERRY_MODULE_SYSTEM
extern const char * const ecma_error_not_module_p;
#else /* !JERRY_MODULE_SYSTEM */
extern const char * const ecma_error_module_not_supported_p;
#endif /* JERRY_MODULE_SYSTEM */
extern const char * const ecma_error_callback_is_not_callable;
extern const char * const ecma_error_arraybuffer_is_detached;
extern const char * const ecma_error_cannot_convert_to_object;
extern const char * const ecma_error_class_is_non_configurable;
extern const char * const ecma_error_argument_is_not_an_object;
extern const char * const ecma_error_target_is_not_a_constructor;
extern const char * const ecma_error_argument_is_not_an_regexp;
extern const char * const ecma_error_invalid_array_length;
extern const char * const ecma_error_local_variable_is_redeclared;
extern const char * const ecma_error_expected_a_function;
extern const char * const ecma_error_class_constructor_new;
/* snapshot errors */
extern const char * const ecma_error_maximum_snapshot_size;
extern const char * const ecma_error_regular_expression_not_supported;
extern const char * const ecma_error_snapshot_buffer_small;
extern const char * const ecma_error_snapshot_flag_not_supported;
extern const char * const ecma_error_cannot_allocate_memory_literals;
extern const char * const ecma_error_tagged_template_literals;
#endif /* !ECMA_ERRORS_H */
+1
View File
@@ -16,6 +16,7 @@
#ifndef ECMA_GLOBALS_H
#define ECMA_GLOBALS_H
#include "ecma-errors.h"
#include "config.h"
#include "jrt.h"
#include "lit-magic-strings.h"
@@ -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 (ecma_error_arraybuffer_is_detached));
}
/* b. */
@@ -437,7 +437,7 @@ ecma_builtin_array_prototype_object_push (const ecma_value_t *argument_list_p, /
{
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 (ecma_error_invalid_array_length));
}
if (arguments_number == 0)
@@ -1505,7 +1505,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 (ecma_error_invalid_array_length));
}
if (args_number == 0)
@@ -1849,7 +1849,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 (ecma_error_callback_is_not_callable));
}
/* We already checked that arg1 is callable */
@@ -1932,7 +1932,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 (ecma_error_callback_is_not_callable));
}
/* 6. */
@@ -2026,7 +2026,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 (ecma_error_callback_is_not_callable));
}
/* 6. */
@@ -2134,7 +2134,7 @@ 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 (ecma_error_callback_is_not_callable));
}
/* 5. */
@@ -2352,7 +2352,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 (ecma_error_callback_is_not_callable));
}
/* We already checked that predicate is callable, so it will always be an object. */
@@ -2836,7 +2836,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 (ecma_error_callback_is_not_callable));
}
/* 4. */
@@ -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 (ecma_error_callback_is_not_callable));
}
/* 3.b */
@@ -135,7 +135,7 @@ ecma_builtin_array_object_from (ecma_value_t this_arg, /**< 'this' argument */
if (ecma_is_value_undefined (array) || ecma_is_value_null (array))
{
ecma_free_value (using_iterator);
return ecma_raise_type_error (ECMA_ERR_MSG ("Cannot convert undefined or null to object"));
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_cannot_convert_to_object));
}
/* 6.c */
@@ -298,7 +298,7 @@ iterator_cleanup:
if (ecma_is_value_undefined (array) || ecma_is_value_null (array))
{
ecma_raise_type_error (ECMA_ERR_MSG ("Cannot convert undefined or null to object"));
ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_cannot_convert_to_object));
goto cleanup;
}
@@ -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 (ecma_error_invalid_array_length));
}
return ecma_make_object_value (ecma_op_new_array_object (num_uint32));
@@ -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 (ecma_error_arraybuffer_is_detached));
}
uint32_t len = ecma_arraybuffer_get_length (object_p);
@@ -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 (ecma_error_arraybuffer_is_detached));
}
/* 5. */
@@ -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 (ecma_error_arraybuffer_is_detached));
}
return ecma_make_uint32_value (obj_p->header.u.cls.u3.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 (ecma_error_arraybuffer_is_detached));
}
return ecma_make_uint32_value (obj_p->byte_offset);
}
@@ -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 (ecma_error_argument_is_not_an_object));
}
ecma_object_t *obj_p = ecma_get_object_from_value (arg2);
@@ -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 (ecma_error_invalid_array_length));
}
#else /* !JERRY_ESNEXT */
/* 5.b.ii */
@@ -176,7 +176,7 @@ ecma_builtin_intrinsic_dispatch_routine (uint8_t builtin_routine_id, /**< built-
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 (ecma_error_arraybuffer_is_detached));
}
return ecma_typedarray_iterators_helper (this_arg, ECMA_ITERATOR_VALUES);
@@ -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 (ecma_error_argument_is_not_an_object));
}
ecma_object_t *obj_p = NULL;
@@ -1415,7 +1415,7 @@ ecma_builtin_object_dispatch_routine (uint8_t builtin_routine_id, /**< built-in
#if !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 (ecma_error_argument_is_not_an_object));
}
#endif /* !JERRY_ESNEXT */
@@ -1424,7 +1424,7 @@ ecma_builtin_object_dispatch_routine (uint8_t builtin_routine_id, /**< built-in
#if 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 (ecma_error_argument_is_not_an_object));
}
#endif /* JERRY_ESNEXT */
@@ -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 (ecma_error_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 (ecma_error_argument_is_not_an_object));
}
ecma_object_t *target_p = ecma_get_object_from_value (arguments_list[0]);
@@ -183,7 +183,7 @@ ecma_builtin_reflect_dispatch_routine (uint8_t builtin_routine_id, /**< built-in
/* 1. */
if (arguments_number < 1 || !ecma_is_constructor (arguments_list[0]))
{
return ecma_raise_type_error (ECMA_ERR_MSG ("Target is not a constructor"));
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_target_is_not_a_constructor));
}
ecma_object_t *target_p = ecma_get_object_from_value (arguments_list[0]);
@@ -196,7 +196,7 @@ ecma_builtin_reflect_dispatch_routine (uint8_t builtin_routine_id, /**< built-in
/* 3. */
if (!ecma_is_constructor (arguments_list[2]))
{
return ecma_raise_type_error (ECMA_ERR_MSG ("Target is not a constructor"));
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_target_is_not_a_constructor));
}
new_target_p = ecma_get_object_from_value (arguments_list[2]);
@@ -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 (ecma_error_argument_is_not_an_object));
}
switch (builtin_routine_id)
@@ -278,7 +278,7 @@ ecma_builtin_regexp_prototype_compile (ecma_value_t this_arg, /**< this */
#if !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 ("Argument 'this' is not a RegExp object"));
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_argument_is_not_an_regexp));
}
#endif /* !JERRY_ESNEXT */
@@ -745,7 +745,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 ("Argument 'this' is not a RegExp object"));
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_argument_is_not_an_regexp));
}
ecma_extended_object_t *re_obj_p = (ecma_extended_object_t *) obj_p;
@@ -765,7 +765,7 @@ ecma_builtin_regexp_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 RegExp object"));
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_argument_is_not_an_regexp));
}
ecma_extended_object_t *re_obj_p = (ecma_extended_object_t *) obj_p;
@@ -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 (ecma_error_arraybuffer_is_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 (ecma_error_arraybuffer_is_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 (ecma_error_arraybuffer_is_detached));
}
ecma_typedarray_info_t target_info = ecma_typedarray_get_info (typedarray_p);
@@ -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 (ecma_error_arraybuffer_is_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 (ecma_error_callback_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 (ecma_error_callback_is_not_callable));
}
return ecma_builtin_typedarray_prototype_sort (this_arg, &info, arguments_list_p[0]);
@@ -173,7 +173,7 @@ ecma_op_new_array_object_from_length (ecma_length_t length) /**< length of the n
#if JERRY_ESNEXT
if (length > UINT32_MAX)
{
ecma_raise_range_error (ECMA_ERR_MSG ("Invalid Array length"));
ecma_raise_range_error (ECMA_ERR_MSG (ecma_error_invalid_array_length));
return NULL;
}
#endif /* JERRY_ESNEXT */
@@ -996,7 +996,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 (ecma_error_invalid_array_length));
}
/* Only the writable and data properties can be modified. */
@@ -756,7 +756,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 (ecma_error_callback_is_not_callable));
}
JERRY_ASSERT (ecma_is_value_object (predicate));
+3 -3
View File
@@ -818,7 +818,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 (ecma_error_expected_a_function));
goto free_desc;
}
@@ -856,7 +856,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 (ecma_error_expected_a_function));
goto free_desc;
}
@@ -1098,7 +1098,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 (ecma_error_argument_is_not_an_object));
return NULL;
}
ecma_object_t *obj_p = ecma_get_object_from_value (arr);
@@ -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 (ecma_error_arraybuffer_is_detached));
}
/* 5. */
@@ -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 (ecma_error_arraybuffer_is_detached));
}
/* 9. */
@@ -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 (ecma_error_arraybuffer_is_detached));
}
/* GetViewValue 7., SetViewValue 9. */
@@ -815,7 +815,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 (ecma_error_arraybuffer_is_detached));
}
uint32_t expected_length = (ecma_arraybuffer_get_length (arraybuffer_p) >> element_size_shift);
+1 -1
View File
@@ -1278,7 +1278,7 @@ parser_error_to_string (parser_error_t error) /**< error code */
#if JERRY_ESNEXT
case PARSER_ERR_VARIABLE_REDECLARED:
{
return "Local variable is redeclared";
return ecma_error_local_variable_is_redeclared;
}
case PARSER_ERR_LEXICAL_SINGLE_STATEMENT:
{
+2 -2
View File
@@ -1063,7 +1063,7 @@ ecma_op_implicit_constructor_handler_cb (const jerry_call_info_t *call_info_p, /
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 (ecma_error_class_constructor_new));
}
return opfunc_init_class_fields (call_info_p->function, call_info_p->this_value);
@@ -1084,7 +1084,7 @@ ecma_op_implicit_constructor_handler_heritage_cb (const jerry_call_info_t *call_
{
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 (ecma_error_class_constructor_new));
}
ecma_object_t *func_obj_p = ecma_get_object_from_value (call_info_p->function);
+7 -7
View File
@@ -701,7 +701,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 (ecma_error_expected_a_function));
}
else
{
@@ -785,7 +785,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 (ecma_error_expected_a_function));
}
else
{
@@ -1643,7 +1643,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 (ecma_error_local_variable_is_redeclared));
goto error;
}
@@ -1668,7 +1668,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 (ecma_error_local_variable_is_redeclared));
}
JERRY_ASSERT (ECMA_IS_VALUE_ERROR (result));
@@ -1689,7 +1689,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 (ecma_error_local_variable_is_redeclared));
goto error;
}
@@ -1950,7 +1950,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 (ecma_error_class_is_non_configurable));
goto error;
}
@@ -1983,7 +1983,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 (ecma_error_class_is_non_configurable));
goto error;
}