[SOLVED] My errors get intercepted by editor connection on error

I don’t know why but now all my js errors get intercepted by the connection.on('error') of the connect function in the launch.js file.

It prints just “3” and silent. Also, it doesn’t show anything in the editor.
To read my error I have to put a breakpoint end print the msg argument of the error event.

Do you know what’s going on?

I think I know why, but I don’t know how to avoid this behavior (if it’s even possible)

I’m loading a new scene, and the errors are happening in the callback of the app.loadSceneHierarchy method so they get caught as connection errors :frowning:

ok, I found a workaround.
I run my code in the callback using a window.setTimeout with zero ms.

It’d really help if you shared a simple project that reproduces this.

sure… I’ll try (end of day here :slight_smile: )

here is a super simple repro:

https://playcanvas.com/project/541587/overview/load-scene-callback

1 Like

did you get to the bottom of this?

The only thing I was able to do was to debug and confirm that the initialize method is wrapped inside a try/catch of the onmessage method of the Connection class that is used to load a new scene.
This is not part of the opensource code, so there isn’t much I can do.

@vaios Could you confirm and see if there is a better solution?

1 Like

Hi, we will deploy a fix for this in our next deployment. Thanks for reporting :slight_smile:

1 Like