openfl / lime

A foundational Haxe framework for cross-platform development
https://lime.openfl.org/
MIT License
749 stars 359 forks source link

Implement `onUncaughtError` event for thread pools #1777

Open player-03 opened 3 months ago

player-03 commented 3 months ago

This handles errors thrown from the other thread. In 8.1.0 and earlier, such errors weren't handled at all. In 8.2.0 prior to this PR, we caught the errors and dispatched them as onError events.

This PR distinguishes the two sources of error (throw and sendError()), and also enables the user to get the stack trace for a thrown error.

If the user doesn't add a listener, we instead use Log.error() to ensure that something shows up in the console. (We don't want to suddenly start hiding errors.)