-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
Exception thrown from addon #2380
Comments
Will need more information, test case, etc. before we can help. |
I'm having some difficulties producing a simple test case, because the addon where the error is happening links to a third-party library, and the exception is thrown from native code in response to an asynchronous network event received by the native library (since the main project concerns itself with providing bindings for the library). Here's one way to reproduce the problem (tested on Fedora 21) using the actual project:
At this point, the client will quit silently after a short while. Now,
At this point, after a short while you will see an exception complaining about an unsupported payload type. This is the desired behaviour, not the silence you get with node 0.12. I'm sorry I can't come up with anything shorter :/ |
When you say "exception", do you mean C++ code throwing a C++ exception or raising a JS exception with |
The latter. The bindings code generates a JS exception that is never printed. I use nan though: https://github.com/otcshare/iotivity-node/blob/736665c3f7c2a4440449d70020e62841e6510d8e/src/structures/oc-payload.cc#L232 |
I'm still trying to stub out the library, BTW. It uses a processing loop, so, like, setInterval( function() {
iotivity.OCProcess();
}, 1000 ); So OCProcess(), ends up calling a function, which ends up calling a function, etc., which ultimately ends up calling js_OCPayload(), which then throws the exception. So, I'm trying to replace the library with a simple routine that just throws an exception after so many calls to the native function. EDIT I mean |
Well, it's not as simple as that, it seems. This produces the exception in the terminal with both 0.12 and 0.10. |
If you use |
@bnoordhuis I commented out the MakeCallback() and the exception is now thrown. Thus, it seems this is indeed related to that issue. Was nodejs/nan#284 the issue you were looking for? |
In particular, nodejs/nan#284 (comment) |
That's probably it. I thought there was an io.js issue about it as well but maybe I've mixed up things. |
|
@trevnorris how do you mean the "first JS frame on the call stack"? The call stack in my case starts with a JS interval callback firing, which calls a binding that goes deep into the library for which I'm providing bindings. The library, in turn, calls a C function pointer I gave it earlier which gives me a pointer to the So, the stack is like
Does this qualify as "the first JS frame on the call stack"? |
@gabrielschulhof In your case the |
@trevnorris Thanks! |
I think this was answered? Closing. |
@Fishrock123 Um. I'll assume you meant to close this. |
In 0.10, when throwing an exception from a C++ addon it would be printed and the process would exit. In 0.12, the exception is not printed, and the process just exits. This makes it really difficult to inform the user about missing stuff or invalid data.
The text was updated successfully, but these errors were encountered: