Skip to content

Print unhandled errors in REPL mode #1004

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 1 commit into from
Apr 14, 2016

Conversation

dbatyai
Copy link
Member

@dbatyai dbatyai commented Apr 12, 2016

JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu

@dbatyai dbatyai added enhancement An improvement minor labels Apr 12, 2016
@LaszloLango LaszloLango self-assigned this Apr 12, 2016
@@ -560,19 +560,12 @@ main (int argc,
jerry_api_value_t ret_val;
ret_code = jerry_api_eval (buffer, len, false, false, &ret_val);

if (ret_code == JERRY_COMPLETION_CODE_OK)
// print return value
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thins comment should be fixed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@dbatyai dbatyai force-pushed the print_errors_in_repl branch from 493cd75 to 6eaeb9a Compare April 13, 2016 13:12
@@ -527,17 +527,14 @@ jerry_api_convert_eval_completion_to_retval (jerry_api_value_t *retval_p, /**< [
* code execution */
{
jerry_completion_code_t ret_code;
jerry_api_convert_ecma_value_to_api_value (retval_p, completion);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that this function is being touched, it would be nice to update its doc comment. The "Note:" part could better be referring to jerry_api_release_value.

Another stylistic suggestion: the below 10 lines could be written in a single line...

return !ecma_is_value_error (completion) ? JERRY_COMPLETION_CODE_OK : JERRY_COMPLETION_CODE_UNHANDLED_EXCEPTION;

Much cleaner. (And still within the 120 chars-per-line limit.)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@akiss77, +1

If it is too long, then write like this:

return !ecma_is_value_error (completion) ? JERRY_COMPLETION_CODE_OK
                                         : JERRY_COMPLETION_CODE_UNHANDLED_EXCEPTION;

@akosthekiss
Copy link
Member

LGTM otherwise (FWIW)

jerry_api_value_t ret_val;
ret_code = jerry_api_eval (buffer, len, false, false, &ret_val);

if (ret_code == JERRY_COMPLETION_CODE_OK)
/* Print return value */
const jerry_api_value_t args[] = {ret_val};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a space before and after ret_val.

@LaszloLango
Copy link
Contributor

LGTM after comments being fixed.

@LaszloLango LaszloLango assigned zherczeg and unassigned LaszloLango Apr 14, 2016
JerryScript-DCO-1.0-Signed-off-by: Dániel Bátyai dbatyai@inf.u-szeged.hu
@dbatyai dbatyai force-pushed the print_errors_in_repl branch from 6eaeb9a to 37333e2 Compare April 14, 2016 09:28
@zherczeg
Copy link
Member

LGTM

@bzsolt bzsolt merged commit e191794 into jerryscript-project:master Apr 14, 2016
@dbatyai dbatyai deleted the print_errors_in_repl branch April 19, 2016 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An improvement minor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants