-
Notifications
You must be signed in to change notification settings - Fork 138
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
Callbacks get called twice if they throw an error #76
Comments
Did you figure out the issue? |
I'll bet this is caused by the issue we discussed some time ago where streamline is catching all exceptions in order to return them in the callback as errors. If an exception occurs in the callback passed to DataObject.get(), that callback will be called a second time. |
Good memory, @blevine. @rgjamkhedkar closed this, so I assume you found that to be the issue? |
Yes @blevine. That was the issue. I didn't know this could happen. Sorry for that, I should have checked that first. |
I'm going to reopen this and see if I can prevent the callback from getting called twice in the case that the callback throws an error. |
If the callback throws a synchronous error the first time. Issue #76.
Okay, spent some time investigating this, and I think it's indeed a Streamline bug: If that's right and it's fixed there, then this should naturally get fixed in the next recompile/release. I've added a test case to easily test this in the future. Thanks again guys. |
I'm seeing this too, possible to see a new release for this fix? Thanks |
I'm def interested in getting the fix out for this. Just working with the Streamline.js author on it, and waiting for the fix in Streamline to be published to npm. Hopefully soon! Cheers. |
I have this issue too, it was very difficult to realize that node-neo4j is causing it. I thought that it was async.js (http://stackoverflow.com/questions/19844550/async-js-error-flow-explanation) but with this little test all my doubts were resolved : http://pastebin.com/aNcNWjLp . Thanks UPDATE : Thanks for link to the streamlinejs issue, I installed the last version 0.10.0 and it's fixed. I think that is important to update the npm package of node-neo4j too . Thanks 👍 |
Should address issue #76, but that test is still failing. Investigating...
Thanks for your patience guys. Streamline 0.10 doesn't quite fix this 100%, but I've been working with Bruno on it. |
Update and good news on this: Bruno found the exact cause of this, and he has fixed it. As soon as the fix gets published to npm, I'll release an update as well! |
Short-circuit test for now since it still appears to fail to Mocha, but we can see manually/visually that it doesn't. Need to figure out a way.
Okay, this has been fully fixed and published to npm as version 1.1.0! |
[Edited title. Original: "getNodeById callback called multiple times". —@aseemk]
I have this code:
DataObject.get = function(id, callback) {
db.getNodeById(id, function(err, node) {
if (err) {
return callback(err);
}
return callback(null, node);
});
};
In this, callback function to getNodeById is called multiple times, I don't know why. I know for sure that DataObject.get function is called only once.
First time callback is called, I get result as expected. But when it is called second time I get an error : ReferenceError: param is not defined.
Is this a problem in node-neo4j code or in my code? I am certainly not an expert in node.js, so I might well be making a mistake.
The text was updated successfully, but these errors were encountered: