Skip to content
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

Improve location info for syntax errors. #4816

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zherczeg
Copy link
Member

@zherczeg zherczeg commented Nov 3, 2021

No description provided.

@zherczeg zherczeg force-pushed the syntax_error branch 8 times, most recently from b27ea39 to e07af28 Compare November 4, 2021 10:35
@zherczeg
Copy link
Member Author

zherczeg commented Nov 4, 2021

Patch is ready for review.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg [email protected]
@rerobika
Copy link
Member

rerobika commented Nov 5, 2021

@zherczeg Please rebase after #4818 .

}
}

return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("Location is not available")));
Copy link
Member

Choose a reason for hiding this comment

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

I'm wondering wether it would be better to simply return with undefined if there is no location, or with a pre-defined magic string. And similarly when error messages are disabled.

It feels to me like the location info is an added bonus, it can be used when it's available, but if it's not, then that's not really a problem. Or at least not something that would warrant an error.

* error, otherwise
*/
jerry_value_t
jerry_get_syntax_error_location (jerry_value_t value, /**< SyntaxError object */
Copy link
Member

Choose a reason for hiding this comment

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

How about not making this syntax error specific, and changing the name to be generic for errors. Functionally it already seems to be generic. Also in the future we could possibly include location info for other error types as well.

Same for the jerry_syntax_error_location_t type, I would just call it jerry_error_location_t.

@LaszloLango LaszloLango added the abandoned Abandoned by reviewers or author label Nov 13, 2024
@LaszloLango
Copy link
Contributor

@zherczeg please rebase

@ossy-szeged ossy-szeged added the enhancement An improvement label Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
abandoned Abandoned by reviewers or author enhancement An improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants