Skip to content

Uncaught (in promise) error when websocket attempts exhausted #947

@filipkis

Description

@filipkis

Description
When I setup a HocuspocusProviderWebscoket to have limited maxAttempts (e.g. let's say 2) then after the last attempt, there is an Uncaught (in promise) error in the console and there is no obvious way to capture it.

Steps to reproduce the bug

Setup simple example like this:

const  websocket = new HocuspocusProviderWebsocket({
    maxAttempts: 2, 
    url: 'ws://127.0.0.1:1337',
  });

const document = new Y.Doc();

const provider = new HocuspocusProvider({
      websocketProvider: websocket,
      name: 'Some name',
      document: document
});
provider.attach();

Make sure you don't actually have the hocuspocus server running to be able to observe the error.

Observe error in the console:

Image

Expected behavior
This uncaught options should either not happen, or there should be a way to handle it from the ProviderWebsocket configuration.

Environment?

  • operating system: macOS
  • browser: Chrome
  • mobile/desktop: desktop
  • Hocuspocus version: 3.1.1

Additional context

I believe the issue steams from https://github.com/ueberdosis/hocuspocus/blob/main/packages/provider/src/HocuspocusProviderWebsocket.ts#L243C1-L264C1 where the catch just throws the error again in such case, but there is no way to handle it.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions