Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Any request resulting in the error throws Uncaught exception #47

Closed
amarchen opened this issue Nov 16, 2011 · 7 comments
Closed

Any request resulting in the error throws Uncaught exception #47

amarchen opened this issue Nov 16, 2011 · 7 comments

Comments

@amarchen
Copy link

Any request resulting in the error code from the server side to client running node.js 0.6.0 and restler results in the following (or similar stack) trace:

node restler_test.js 
The "sys" module is now called "util". It should have a similar interface.

events.js:50
        throw new Error("Uncaught, unspecified 'error' event.");
              ^
Error: Uncaught, unspecified 'error' event.
    at EventEmitter.emit (events.js:50:15)
    at EventEmitter._respond (/Users/artem/.node_libraries/restler/lib/restler.js:127:12)
    at EventEmitter._fireEvents (/Users/artem/.node_libraries/restler/lib/restler.js:131:52)
    at /Users/artem/.node_libraries/restler/lib/restler.js:115:19
    at IncomingMessage.<anonymous> (/Users/artem/.node_libraries/restler/lib/restler.js:208:5)
    at IncomingMessage.<anonymous> (/Users/artem/.node_libraries/restler/lib/restler.js:200:49)
    at IncomingMessage.<anonymous> (/Users/artem/.node_libraries/restler/lib/restler.js:113:32)
    at IncomingMessage.emit (events.js:88:20)
    at HTTPParser.onMessageComplete (http.js:137:23)
    at Socket.ondata (http.js:1125:24)

Investigation showed that the problem is with the event name and is probably similar to (or same as) socketio/socket.io#476

For example changing

  _fireEvents: function(body, response) {
    if (parseInt(response.statusCode) >= 400) this._respond('error', body, response);

to

  _fireEvents: function(body, response) {
    if (parseInt(response.statusCode) >= 400) this._respond('restlererror', body, response);

Makes everything work again, but of course event is incorrect then

@ghost
Copy link

ghost commented Nov 28, 2011

Also seeing this issue - changing the error -> restlererror does indeed fix the issue with the behaviour as amarchen describes.

@amarchen
Copy link
Author

Looking at the LearnBoost thread, fix also looks quite simple, but it has to be done in the socket and I have no idea how to verify it.

@ayoung
Copy link
Collaborator

ayoung commented Dec 8, 2011

The above commit should fix this issue.

@ayoung ayoung closed this as completed Dec 8, 2011
@amarchen
Copy link
Author

amarchen commented Dec 8, 2011

Cool! Will probably give restler a try again next time I am on the same project again (currently just uses plain node.js and http for testing the remote API)

@ayoung
Copy link
Collaborator

ayoung commented Dec 8, 2011

I basically just implemented the same fix as in the link you sent. Fix is in v0.2.2.

@amarchen
Copy link
Author

amarchen commented Dec 9, 2011

0.2.2? I didn't realize Restler has any versions at all. The project doesn't seem to have any branches, tags or downloads. Oh well, the fix is in the master branch anyway.

@ayoung
Copy link
Collaborator

ayoung commented Dec 9, 2011

there are versions on the npm registry. but you're right, restler should have tags for the versions.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants