Is there a way make an error screen for any error ocurred?

So, doing my usual tomfoolery for my game, I stumbled with this error message: “Texture key already in use: pressenter_text” and thought to myself…

Is there any way to detect this errors to launch an error screen? So that’s what I am trying to figure out, is there any way to trigger a scene when the console or the game detects an error at any time?

You can use a window error event handler (and try catch in that, to avoid an error spiral).

However, Texture key already in use … is not a true runtime error but a message from Phaser using console.error(), so it wouldn’t apply.

So how can I detect the errors in Phaser too?

You would still get real errors from Phaser or your own code using that method, just not console.error() messages.

And for that particular texture problem, you can check this.textures.exists(key) first.

I’ll see if that works, thanks! (also, the error was a multiple call for starting a scene, I fixed it adding a check for detecting if the player is or isn’t on a specific state, if it isn’t, it will enable itself, making it so it doesn’t repeat the this.scene.launch)