Removed unnecessary code from try block. Only decode packet is needed. #734

Merged
merged 1 commit into from Jul 24, 2014

Conversation

Projects
None yet
4 participants
Contributor

adelura commented Jul 23, 2014

Take in mind this code:

socket.on('message', function (data) {
  // doing some stuff in my application

  // but then my application throw error
  throw new Error('Something went wrong here :(');
});

Two unwanted things happend here:

  • I can't see that error thrown in browser console.
  • Connection with server is terminated here.

That's because in Transport.prototype.onData calling onPacket method is in same call stack as my application code listed above and additionaly is in try catch block. Decode packet error handler think that there was something wrong with decoding packet, and as result it terminates connection. But it's not true because error was raised in my application.

rauchg added a commit that referenced this pull request Jul 24, 2014

Merge pull request #734 from adelura/master
Removed unnecessary code from try block. Only decode packet is needed.

@rauchg rauchg merged commit 6eee84b into socketio:master Jul 24, 2014

1 check failed

continuous-integration/travis-ci The Travis CI build failed
Details
Contributor

rauchg commented Jul 24, 2014

Perfect. Regression test would be nice.

Contributor

nkzawa commented Jul 24, 2014

I think this file should not be modified directly.

Contributor

defunctzombie commented Jul 24, 2014

as @nkzawa said, this changes the wrong file.

Contributor

adelura commented Jul 24, 2014

So which file should be changed? I found out that socket.io-client have dependency in which same code exists. Do you import changes from this repository when making release, or there is some builder for socket.io-client? Dependency which I mentioned is engine.io-client

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment