-
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: rework error handling #178
Conversation
src/jsrs_parser.cc
Outdated
@@ -273,7 +269,7 @@ Local<Value> ParseBool(Isolate* isolate, | |||
*size = 5; | |||
} else { | |||
THROW_EXCEPTION(TypeError, "Invalid format: expected boolean"); | |||
result = Undefined(isolate); | |||
result = MaybeLocal<Value>(); |
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.
Isn't this the very same value that result
was initialized with at line 263?
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.
Yeah, right, I will remove redundant assignments, thanks for catching that 😃
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.
src/jsrs_parser.cc
Outdated
return Undefined(isolate); | ||
} | ||
MaybeLocal<Value> result; | ||
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 a nit but maybe it's better to make it into one statement? =)
src/jsrs_parser.cc
Outdated
return Undefined(isolate); | ||
} | ||
MaybeLocal<Value> t; | ||
t = kParseFunctions[current_type](isolate, |
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.
Same as before, this one will event fit actually.
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.
Awesome, thanks. Not only this easier to read and maintain, but it also makes parsing up to 10% faster, from what I see.
Landed in |
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 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 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 using TryCatch introduced in
29b3e19 by using MaybeLocal instead.
Refs: #143