-
Notifications
You must be signed in to change notification settings - Fork 10
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
parser: fix exceptions being ignored #143
Conversation
* Avoid continuing execution after exception is thrown inside a parsing method call. * Return undefined when possible in cases of exceptions raising in all of the methods (to reduce memory usage). Fixes: #142
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I'd like if function calls in 'try/catch' used same style - all args in one line with or without newline after equals or each arg on separate line, to make code more consistent and easy to read.
TryCatch trycatch(isolate); | ||
result = | ||
(kParseFunctions[type])(isolate, str + start_pos, end, &parsed_size); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, is this space necessary, as you don't have it in the other places?
The thing I don't like in this approach is that we basically use JavaScript exceptions instead of C++ ones to handle errors inside the C++ code. How much is the performance overhead, btw? I'd prefer to handle errors in C++ code properly using any pattern you will find appropriate and only throwing JavaScript exceptions from the highest level functions. |
@aqrln, well, I haven't checked the performance overhead, but maybe you can do it if you want. |
Well, that's what Google C++ Style Guide suggests to do, isn't that? |
@aqrln, I, probably, should have clarified that I was talking about JS exceptions in the part you quoted, and Google C++ Style Guide gives no opinion on them, because it is out of its scope, obviously. |
@belochub yeah, and my point is that using JavaScript exceptions instead of C++ ones isn't the best way to work around the limitations induced by the styleguide ;) That said, I do have to admit that we currently have a bug in the parser and this PR resolves the issue in an acceptable (though not very perfect to me) way, so I'm not gonna stand against it. Let's just fix it. I'm okay with discussing the preferred way of handling errors inside the parser internals and refactoring the code later, if there'll be a need to do so. |
@aqrln, right, you are saying that it is not a perfect way of fixing it, but do you have a better solution in mind right now? |
I don't. I would propose it immediately if I did. The point that I'm trying to communicate is just this doesn't feel like quite the best approach to me, but I'm fine with it as long as there are no better alternatives. |
Okay then, let's lend this as it is and whenever we get a better solution we will discuss it and refactor this part. |
* Avoid continuing execution after exception is thrown inside a parsing method call. * Return undefined when possible in cases of exceptions raising in all of the methods (to reduce memory usage). PR-URL: #143 Fixes: #142 Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Landed in 29b3e19. Thanks! |
* Avoid continuing execution after exception is thrown inside a parsing method call. * Return undefined when possible in cases of exceptions raising in all of the methods (to reduce memory usage). PR-URL: #143 Fixes: #142 Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
* Avoid continuing execution after exception is thrown inside a parsing method call. * Return undefined when possible in cases of exceptions raising in all of the methods (to reduce memory usage). PR-URL: #143 Fixes: #142 Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
* Avoid continuing execution after exception is thrown inside a parsing method call. * Return undefined when possible in cases of exceptions raising in all of the methods (to reduce memory usage). PR-URL: metarhia/jstp#143 Fixes: metarhia/jstp#142 Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Avoid using TryCatch introduced in 29b3e197ae4c33d1b9057b57731b4c422de764f3 by using MaybeLocal instead. PR-URL: metarhia/jstp#178 Refs: metarhia/jstp#143 Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com>
* Avoid continuing execution after exception is thrown inside a parsing method call. * Return undefined when possible in cases of exceptions raising in all of the methods (to reduce memory usage). PR-URL: metarhia/jstp#143 Fixes: metarhia/jstp#142 Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Avoid using TryCatch introduced in 29b3e197ae4c33d1b9057b57731b4c422de764f3 by using MaybeLocal instead. PR-URL: metarhia/jstp#178 Refs: metarhia/jstp#143 Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com>
* Avoid continuing execution after exception is thrown inside a parsing method call. * Return undefined when possible in cases of exceptions raising in all of the methods (to reduce memory usage). PR-URL: metarhia/jstp#143 Fixes: metarhia/jstp#142 Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Avoid using TryCatch introduced in 29b3e197ae4c33d1b9057b57731b4c422de764f3 by using MaybeLocal instead. PR-URL: metarhia/jstp#178 Refs: metarhia/jstp#143 Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com>
inside a parsing method call.
raising in all of the methods (to reduce memory usage).
Fixes: #142