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

Multiple 'complete' event in JSON parsing #94

Closed
wants to merge 2 commits into from

Conversation

wanasit
Copy link

@wanasit wanasit commented Aug 27, 2012

I remove from callback() from try..catch.. block. Because, when the error was thrown in (user's) callback, your try...catch will catch it.

Try with this code...

var rest = require('./restler');
var express = require('express');
var count = 0;

var app = express();
app.listen(8083);
app.get('/',function(req,res) { res.send({'Hello':'World'});})

rest.get('http://localhost:8083').on('complete',function(res) {

console.log('count:'+count++)
console.log(res)

//Make..error
res.forEach();
})

@jimmyz
Copy link

jimmyz commented Nov 29, 2012

Yes. Please pull this!!!

@luto
Copy link

luto commented Apr 7, 2013

I'm also running into this error... can someone pull this, please?

@mortizbey
Copy link

I am also having this error but I don't think it is for the same reason as specified here. I added this code by hand to my restler module and it didn't solve it. This problem (at least in my case) started when upgrading my node.js version to the latest one 0.10.2 I believe. What version of node do you have? I think it is an issue of how node is handling the eventsin this new version. I think it is now using an event bus or something similar that triggers all on complete events regardless of their "get" closure scope. What do you guys think?

@jwulf
Copy link

jwulf commented Apr 25, 2013

+1 to this, I was getting the restler on complete fire twice, and spent ages tracking through the code to find out why. It was an unhandled exception being thrown in my callback code!

@eggie5
Copy link

eggie5 commented Aug 5, 2013

I experienced this too

@john-kurkowski
Copy link

+1

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.

None yet