Skip to content

add try/catch to HandleOKCallback - #81

Merged
mapsam merged 5 commits into
masterfrom
trycatch
Apr 18, 2018
Merged

add try/catch to HandleOKCallback#81
mapsam merged 5 commits into
masterfrom
trycatch

Conversation

@mapsam

@mapsam mapsam commented Apr 13, 2018

Copy link
Copy Markdown
Contributor

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

mapsam commented Apr 16, 2018

Copy link
Copy Markdown
Contributor Author

@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

GretaCB commented Apr 18, 2018

Copy link
Copy Markdown

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

mapsam commented Apr 18, 2018

Copy link
Copy Markdown
Contributor Author

Thanks @GretaCB! 🙇

@mapsam
mapsam merged commit 5f0ec8b into master Apr 18, 2018
@mapsam
mapsam deleted the trycatch branch April 18, 2018 17:37
Comment thread src/vtquery.cpp
set_property(prop, properties_obj);
}
try {
Nan::HandleScope scope;

Copy link
Copy Markdown
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
Copy Markdown
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