empiricaly / empirica

Open source project to tackle the problem of long development cycles required to produce software to conduct multi-participant and real-time human experiments online.
https://empirica.ly/
Apache License 2.0
44 stars 8 forks source link

Unhandled error in `Tajriba.emit` #483

Closed frasalvi closed 7 months ago

frasalvi commented 7 months ago

Is there an existing issue for this?

What happened?

I have caught a bunch of Error: Unhandled error. (undefined) from Tajriba.emit(assets/index) on the client side, thanks to Sentry. There are no relevant logs on the server side, and the error seems to be non-breaking so far: the users' pages just go white for a few seconds, and then get restored as normal.

Steps To Reproduce

No response

Empirica Version

Version: v1.9.0
SHA:     6dc8adb
Build:   166
Branch:  main
Time:    2024-01-01T08:11:38Z

What OS are you seeing the problem on?

Windows

What browser are you seeing the problem on?

Chrome

Relevant log output

[from Sentry]

thrown at /assets/index.df48a287.js in Tajriba.emit at line 39039:15

    if (args.length > 0)
      er = args[0];
    if (er instanceof Error) {
      throw er;
    }
    var err = new Error(
      "Unhandled error." + (er ? " (" + er.message + ")" : "")
    );
    err.context = er;
    throw err;
  }

Anything else?

No response

Code of Conduct

frasalvi commented 7 months ago

Attaching also the Raw trace from Sentry:

Error: Unhandled error. (undefined)
  at Tajriba.emit(/assets/index.df48a287.js:39039:15)
  at error(/assets/index.df48a287.js:39469:16)
  at Object.emit(/assets/index.df48a287.js:30885:11)
  at socket2.onerror(/assets/index.df48a287.js:30938:42)
npaton commented 7 months ago

This appears to be linked to a connection error (disconnection). The player should recover automatically from this. There is nothing we can do about disconnections, it can just happen, for whatever reason. The system will just try to reconnect. In the next update, I have added an intercept for the disconnection and it won't throw this cryptic error anymore, but the behavior should otherwise be the same.