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

handle "parse" errors #1554

Closed
sebseb7 opened this issue Sep 25, 2022 · 2 comments
Closed

handle "parse" errors #1554

sebseb7 opened this issue Sep 25, 2022 · 2 comments
Labels
enhancement New feature or request
Milestone

Comments

@sebseb7
Copy link

sebseb7 commented Sep 25, 2022

when the code inside a .on('someevent',handler) handler fails, a "parse" error occurs, which is silently dropped and the connection is closed.

Solution: have a on('parse_error',data,error) event.

code from manager.ts which silently drops the "e" :

  /**
   * Called with data.
   *
   * @private
   */
  private ondata(data): void {
    try {
      this.decoder.add(data);
    } catch (e) {
      this.onclose("parse error");
    }
  }
@m4heshd
Copy link

m4heshd commented Oct 12, 2022

Wasted so much time on this. Couldn't find WTH was going on because the error was silently consumed by socket.io client.

darrachequesne added a commit that referenced this issue Oct 13, 2022
Following [1], any exception in a user-provided event listener would
get caught in the try...catch of the decoder and result in the
reconnection of the socket.

[1]: c597023

Related:

- #1551
- #1554
- #1557
@darrachequesne
Copy link
Member

This should be fixed by 2403b88, included in version 4.5.3. Sorry for the mess!

@darrachequesne darrachequesne added this to the 4.5.3 milestone Oct 15, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants