Skip to content

Don't use messages for errors by default #941

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ project (Jerry C ASM)
option(ENABLE_LTO "Enable LTO build" ON)
option(ENABLE_LOG "Enable LOG build" OFF)
option(ENABLE_ALL_IN_ONE "Enable ALL_IN_ONE build" OFF)
option(ENABLE_ERROR_MESSAGES "Enable error messages for builtin error objects" OFF)

if("${PLATFORM}" STREQUAL "LINUX")
set(PLATFORM_EXT "LINUX")
Expand Down
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ BUILD_NAME:=
CMAKE_DEFINES:=$(CMAKE_DEFINES) -DENABLE_DATE_SYS_CALLS=$(DATE_SYS_CALLS)
endif

# Fill error messages for builtin error objects
ifneq ($(ERROR_MESSAGES),)
CMAKE_DEFINES:=$(CMAKE_DEFINES) -DENABLE_ERROR_MESSAGES=$(ERROR_MESSAGES)
endif

# All-in-one build
ifneq ($(ALL_IN_ONE),)
CMAKE_DEFINES:=$(CMAKE_DEFINES) -DENABLE_ALL_IN_ONE=$(ALL_IN_ONE)
Expand Down
5 changes: 5 additions & 0 deletions jerry-core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ project (JerryCore C ASM)
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_ENABLE_DATE_SYS_CALLS)
endif()

# Fill error messages for builtin error objects
if("${ENABLE_ERROR_MESSAGES}" STREQUAL "ON")
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_ENABLE_ERROR_MESSAGES)
endif()

# Platform-specific configuration
set(DEFINES_JERRY ${DEFINES_JERRY} ${DEFINES_JERRY_${PLATFORM_EXT}})

Expand Down
24 changes: 12 additions & 12 deletions jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.c
Original file line number Diff line number Diff line change
Expand Up @@ -1201,7 +1201,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 ("");
return ecma_raise_type_error (ECMA_ERR_MSG (""));
}

ecma_value_t ret_value = ecma_make_simple_value (ECMA_SIMPLE_VALUE_EMPTY);
Expand Down Expand Up @@ -2015,7 +2015,7 @@ ecma_builtin_array_prototype_object_every (ecma_value_t this_arg, /**< this argu
/* 4. */
if (!ecma_op_is_callable (arg1))
{
ret_value = ecma_raise_type_error ("");
ret_value = ecma_raise_type_error (ECMA_ERR_MSG (""));
}
else
{
Expand Down Expand Up @@ -2116,7 +2116,7 @@ ecma_builtin_array_prototype_object_some (ecma_value_t this_arg, /**< this argum
/* 4. */
if (!ecma_op_is_callable (arg1))
{
ret_value = ecma_raise_type_error ("");
ret_value = ecma_raise_type_error (ECMA_ERR_MSG (""));
}
else
{
Expand Down Expand Up @@ -2216,7 +2216,7 @@ ecma_builtin_array_prototype_object_for_each (ecma_value_t this_arg, /**< this a
/* 4. */
if (!ecma_op_is_callable (arg1))
{
ret_value = ecma_raise_type_error ("");
ret_value = ecma_raise_type_error (ECMA_ERR_MSG (""));
}
else
{
Expand Down Expand Up @@ -2311,7 +2311,7 @@ ecma_builtin_array_prototype_object_map (ecma_value_t this_arg, /**< this argume
/* 4. */
if (!ecma_op_is_callable (arg1))
{
ret_value = ecma_raise_type_error ("");
ret_value = ecma_raise_type_error (ECMA_ERR_MSG (""));
}
else
{
Expand Down Expand Up @@ -2425,7 +2425,7 @@ ecma_builtin_array_prototype_object_filter (ecma_value_t this_arg, /**< this arg
/* 4. */
if (!ecma_op_is_callable (arg1))
{
ret_value = ecma_raise_type_error ("");
ret_value = ecma_raise_type_error (ECMA_ERR_MSG (""));
}
else
{
Expand Down Expand Up @@ -2550,7 +2550,7 @@ ecma_builtin_array_prototype_object_reduce (ecma_value_t this_arg, /**< this arg
/* 4. */
if (!ecma_op_is_callable (callbackfn))
{
ret_value = ecma_raise_type_error ("");
ret_value = ecma_raise_type_error (ECMA_ERR_MSG (""));
}
else
{
Expand All @@ -2564,7 +2564,7 @@ ecma_builtin_array_prototype_object_reduce (ecma_value_t this_arg, /**< this arg
/* 5. */
if (len_number == ECMA_NUMBER_ZERO && ecma_is_value_undefined (initial_value))
{
ret_value = ecma_raise_type_error ("");
ret_value = ecma_raise_type_error (ECMA_ERR_MSG (""));
}
else
{
Expand Down Expand Up @@ -2601,7 +2601,7 @@ ecma_builtin_array_prototype_object_reduce (ecma_value_t this_arg, /**< this arg
/* 8.c */
if (!k_present)
{
ret_value = ecma_raise_type_error ("");
ret_value = ecma_raise_type_error (ECMA_ERR_MSG (""));
}
}
/* 9. */
Expand Down Expand Up @@ -2695,7 +2695,7 @@ ecma_builtin_array_prototype_object_reduce_right (ecma_value_t this_arg, /**< th
/* 4. */
if (!ecma_op_is_callable (callbackfn))
{
ret_value = ecma_raise_type_error ("");
ret_value = ecma_raise_type_error (ECMA_ERR_MSG (""));
}
else
{
Expand All @@ -2707,7 +2707,7 @@ ecma_builtin_array_prototype_object_reduce_right (ecma_value_t this_arg, /**< th
/* 5. */
if (len_number == ECMA_NUMBER_ZERO && ecma_is_value_undefined (initial_value))
{
ret_value = ecma_raise_type_error ("");
ret_value = ecma_raise_type_error (ECMA_ERR_MSG (""));
}
else
{
Expand Down Expand Up @@ -2747,7 +2747,7 @@ ecma_builtin_array_prototype_object_reduce_right (ecma_value_t this_arg, /**< th
/* 8.c */
if (!k_present)
{
ret_value = ecma_raise_type_error ("");
ret_value = ecma_raise_type_error (ECMA_ERR_MSG (""));
}
}
/* 9. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ ecma_builtin_boolean_prototype_object_value_of (ecma_value_t this_arg) /**< this
}
}

return ecma_raise_type_error ("");
return ecma_raise_type_error (ECMA_ERR_MSG (""));
} /* ecma_builtin_boolean_prototype_object_value_of */

/**
Expand Down
12 changes: 6 additions & 6 deletions jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ ecma_builtin_date_prototype_to_date_string (ecma_value_t this_arg) /**< this arg
if (!ecma_is_value_object (this_arg)
|| ecma_object_get_class_name (ecma_get_object_from_value (this_arg)) != LIT_MAGIC_STRING_DATE_UL)
{
ret_value = ecma_raise_type_error ("Incompatible type");
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Incompatible type"));
}
else
{
Expand Down Expand Up @@ -142,7 +142,7 @@ ecma_builtin_date_prototype_to_time_string (ecma_value_t this_arg) /**< this arg
if (!ecma_is_value_object (this_arg)
|| ecma_object_get_class_name (ecma_get_object_from_value (this_arg)) != LIT_MAGIC_STRING_DATE_UL)
{
ret_value = ecma_raise_type_error ("Incompatible type");
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Incompatible type"));
}
else
{
Expand Down Expand Up @@ -262,7 +262,7 @@ ecma_builtin_date_prototype_get_time (ecma_value_t this_arg) /**< this argument
}
}

return ecma_raise_type_error ("");
return ecma_raise_type_error (ECMA_ERR_MSG (""));
} /* ecma_builtin_date_prototype_get_time */

/**
Expand Down Expand Up @@ -350,7 +350,7 @@ ecma_builtin_date_prototype_set_time (ecma_value_t this_arg, /**< this argument
if (!ecma_is_value_object (this_arg)
|| ecma_object_get_class_name (ecma_get_object_from_value (this_arg)) != LIT_MAGIC_STRING_DATE_UL)
{
ret_value = ecma_raise_type_error ("Incompatible type");
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Incompatible type"));
}
else
{
Expand Down Expand Up @@ -1146,7 +1146,7 @@ ecma_builtin_date_prototype_to_iso_string (ecma_value_t this_arg) /**< this argu

if (ecma_number_is_nan (*prim_num_p) || ecma_number_is_infinity (*prim_num_p))
{
ret_value = ecma_raise_range_error ("");
ret_value = ecma_raise_range_error (ECMA_ERR_MSG (""));
}
else
{
Expand Down Expand Up @@ -1207,7 +1207,7 @@ ecma_builtin_date_prototype_to_json (ecma_value_t this_arg, /**< this argument *
/* 5. */
if (!ecma_op_is_callable (to_iso))
{
ret_value = ecma_raise_type_error ("");
ret_value = ecma_raise_type_error (ECMA_ERR_MSG (""));
}
/* 6. */
else
Expand Down
2 changes: 1 addition & 1 deletion jerry-core/ecma/builtin-objects/ecma-builtin-date.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ ecma_builtin_date_now (ecma_value_t this_arg __attr_unused___) /**< this argumen

if (gettimeofday (&tv, NULL) != 0)
{
return ecma_raise_type_error ("gettimeofday failed");
return ecma_raise_type_error (ECMA_ERR_MSG ("gettimeofday failed"));
}

*now_num_p = ((ecma_number_t) tv.tv_sec) * 1000.0 + ((ecma_number_t) (tv.tv_usec / 1000));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ ecma_builtin_error_prototype_object_to_string (ecma_value_t this_arg) /**< this
// 2.
if (!ecma_is_value_object (this_arg))
{
ret_value = ecma_raise_type_error ("");
ret_value = ecma_raise_type_error (ECMA_ERR_MSG (""));
}
else
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ ecma_builtin_function_prototype_object_to_string (ecma_value_t this_arg) /**< th

if (!ecma_op_is_callable (this_arg))
{
ret_value = ecma_raise_type_error ("");
ret_value = ecma_raise_type_error (ECMA_ERR_MSG (""));
}
else
{
Expand Down Expand Up @@ -89,7 +89,7 @@ ecma_builtin_function_prototype_object_apply (ecma_value_t this_arg, /**< this a
/* 1. */
if (!ecma_op_is_callable (this_arg))
{
ret_value = ecma_raise_type_error ("");
ret_value = ecma_raise_type_error (ECMA_ERR_MSG (""));
}
else
{
Expand All @@ -105,7 +105,7 @@ ecma_builtin_function_prototype_object_apply (ecma_value_t this_arg, /**< this a
/* 3. */
if (!ecma_is_value_object (arg2))
{
ret_value = ecma_raise_type_error ("");
ret_value = ecma_raise_type_error (ECMA_ERR_MSG (""));
}
else
{
Expand Down Expand Up @@ -188,7 +188,7 @@ ecma_builtin_function_prototype_object_call (ecma_value_t this_arg, /**< this ar
{
if (!ecma_op_is_callable (this_arg))
{
return ecma_raise_type_error ("");
return ecma_raise_type_error (ECMA_ERR_MSG (""));
}
else
{
Expand Down Expand Up @@ -231,7 +231,7 @@ ecma_builtin_function_prototype_object_bind (ecma_value_t this_arg, /**< this ar
/* 2. */
if (!ecma_op_is_callable (this_arg))
{
ret_value = ecma_raise_type_error ("");
ret_value = ecma_raise_type_error (ECMA_ERR_MSG (""));
}
else
{
Expand Down Expand Up @@ -392,7 +392,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 ("");
return ecma_raise_type_error (ECMA_ERR_MSG (""));
} /* ecma_builtin_function_prototype_dispatch_construct */

/**
Expand Down
18 changes: 9 additions & 9 deletions jerry-core/ecma/builtin-objects/ecma-builtin-global.c
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,7 @@ ecma_builtin_global_object_decode_uri_helper (ecma_value_t uri __attr_unused___,

if (!lit_read_code_point_from_hex (input_char_p + 1, 2, &decoded_byte))
{
ret_value = ecma_raise_uri_error ("");
ret_value = ecma_raise_uri_error (ECMA_ERR_MSG (""));
break;
}

Expand Down Expand Up @@ -861,7 +861,7 @@ ecma_builtin_global_object_decode_uri_helper (ecma_value_t uri __attr_unused___,

if (!lit_read_code_point_from_hex (input_char_p + 1, 2, &decoded_byte))
{
ret_value = ecma_raise_uri_error ("");
ret_value = ecma_raise_uri_error (ECMA_ERR_MSG (""));
break;
}

Expand Down Expand Up @@ -899,7 +899,7 @@ ecma_builtin_global_object_decode_uri_helper (ecma_value_t uri __attr_unused___,
}
else
{
ret_value = ecma_raise_uri_error ("");
ret_value = ecma_raise_uri_error (ECMA_ERR_MSG (""));
break;
}

Expand Down Expand Up @@ -933,7 +933,7 @@ ecma_builtin_global_object_decode_uri_helper (ecma_value_t uri __attr_unused___,
if (!is_valid
|| !lit_is_utf8_string_valid (octets, bytes_count))
{
ret_value = ecma_raise_uri_error ("");
ret_value = ecma_raise_uri_error (ECMA_ERR_MSG (""));
break;
}

Expand All @@ -943,7 +943,7 @@ ecma_builtin_global_object_decode_uri_helper (ecma_value_t uri __attr_unused___,
if (lit_is_code_point_utf16_high_surrogate (cp)
|| lit_is_code_point_utf16_low_surrogate (cp))
{
ret_value = ecma_raise_uri_error ("");
ret_value = ecma_raise_uri_error (ECMA_ERR_MSG (""));
break;
}

Expand All @@ -962,7 +962,7 @@ ecma_builtin_global_object_decode_uri_helper (ecma_value_t uri __attr_unused___,
}
else
{
ret_value = ecma_raise_uri_error ("");
ret_value = ecma_raise_uri_error (ECMA_ERR_MSG (""));
}
}

Expand Down Expand Up @@ -1074,7 +1074,7 @@ ecma_builtin_global_object_encode_uri_helper (ecma_value_t uri, /**< uri argumen

if (lit_is_code_point_utf16_low_surrogate (ch))
{
ret_value = ecma_raise_uri_error ("");
ret_value = ecma_raise_uri_error (ECMA_ERR_MSG (""));
break;
}

Expand All @@ -1084,7 +1084,7 @@ ecma_builtin_global_object_encode_uri_helper (ecma_value_t uri, /**< uri argumen
{
if (input_char_p == input_end_p)
{
ret_value = ecma_raise_uri_error ("");
ret_value = ecma_raise_uri_error (ECMA_ERR_MSG (""));
break;
}

Expand All @@ -1098,7 +1098,7 @@ ecma_builtin_global_object_encode_uri_helper (ecma_value_t uri, /**< uri argumen
}
else
{
ret_value = ecma_raise_uri_error ("");
ret_value = ecma_raise_uri_error (ECMA_ERR_MSG (""));
break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1337,7 +1337,7 @@ ecma_date_get_primitive_value (ecma_value_t this_arg) /**< this argument */
if (!ecma_is_value_object (this_arg)
|| ecma_object_get_class_name (ecma_get_object_from_value (this_arg)) != LIT_MAGIC_STRING_DATE_UL)
{
ret_value = ecma_raise_type_error ("Incompatible type");
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Incompatible type"));
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ ecma_builtin_helper_get_to_locale_string_at_index (ecma_object_t *obj_p, /**< th
}
else
{
ret_value = ecma_raise_type_error ("");
ret_value = ecma_raise_type_error (ECMA_ERR_MSG (""));
}

ECMA_FINALIZE (to_locale_value);
Expand Down
Loading