nearinfinity/node-oracle — pull request #76 by raztus (2013-08-29 18:49:33+00:00)
Title: V8 callback fixes (regression)

This pull request addresses two issues:

1. Properly handle exceptions when invoking the Javascript callback. This a regression from the fix in #57, which was accidentally removed in b22b00905bcbfdd965ade811c2f227a2fd3678c6.

This fix is slightly different than the one in #57 in that it uses node::MakeCallback instead of creating a V8::TryCatch block. This breaks compatibility with node < 0.5.0, and has a potential negative performance impact, which my non-rigorous tests did not show. However, it has the benefit of being more straightforward than using V8::TryCatch to handle callback errors, and it works with domains. It is also the recommended way to do callbacks (see https://groups.google.com/d/msg/nodejs/jVDIy3RYkuQ/Dk-xdbzQ8v8J).

2. Remove the try/catch in `handleResult` accidentally left behind in b22b00905bcbfdd965ade811c2f227a2fd3678c6, which resulted in both the error and the success callbacks being called if an exception occurred in handleResult.