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

add try/catch to HandleOKCallback #81

Merged
merged 5 commits into from
Apr 18, 2018
Merged

add try/catch to HandleOKCallback #81

merged 5 commits into from
Apr 18, 2018

Conversation

mapsam
Copy link
Contributor

@mapsam mapsam commented Apr 13, 2018

This resolves #69 by adding a try/catch to the callback handler. I'm not 💯 sure how to generate a unit test for this, but confirmed it works locally by adding a throw std::invalid_argument( "this is an error" ); within the try statement, and seeing the error respond as expected in a unit test.

@flippmoke any ideas how to get coverage here? Or should I presume coverage isn't possible in this case?

@mapsam
Copy link
Contributor Author

mapsam commented Apr 16, 2018

@springmeyer any idea why codecov is still trying to cover after the comments? This commit tried to exclude the comments from coverage: 3ebc344

@mapsam mapsam requested a review from flippmoke April 16, 2018 21:13
@GretaCB
Copy link

GretaCB commented Apr 18, 2018

confirmed it works locally by adding a throw std::invalid_argument( "this is an error" ); within the try statement, and seeing the error respond as expected in a unit test.

👍 Looks good to me!

@mapsam
Copy link
Contributor Author

mapsam commented Apr 18, 2018

Thanks @GretaCB! 🙇

@mapsam mapsam merged commit 5f0ec8b into master Apr 18, 2018
@mapsam mapsam deleted the trycatch branch April 18, 2018 17:37
set_property(prop, properties_obj);
}
try {
Nan::HandleScope scope;
Copy link
Contributor

Choose a reason for hiding this comment

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

@mapsam - the HandleScope needs to be outside of the try/catch. Otherwise it will not be able to function to clean up V8 objects in the catch case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch @springmeyer - #84

@springmeyer springmeyer added this to the v0.2.1 milestone Jul 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dangerous abort possible in HandleOKCallback
3 participants