galacean / engine

A typescript interactive engine, support 2D, 3D, animation, physics, built on WebGL and glTF.
https://galacean.antgroup.com/
MIT License
4.04k stars 289 forks source link

Replace `throw` with `console.error` to prevent blocking the main thread #2077

Closed MrKou47 closed 2 months ago

MrKou47 commented 2 months ago

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

This prevent tweaks the shader registration process to provide a better DX for developer.

What is the current behavior? (You can also link to an open issue here)

Currently, if Galacean detects a shader registered with the same name, it will throw an uncaught error, which will block the main thread.

What is the new behavior (if this is a feature change)?

We just console an error inside of throwing it to prevent blocking the user's main thread.