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

merged 1 commit into from Jul 24, 2014


None yet
4 participants

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

rauchg commented Jul 24, 2014

Perfect. Regression test would be nice.


nkzawa commented Jul 24, 2014

I think this file should not be modified directly.


defunctzombie commented Jul 24, 2014

as @nkzawa said, this changes the wrong file.


adelura commented Jul 24, 2014

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

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