You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've noticed that whenever an error is thrown from a function subscribed to Store.changed, the execution is stopped and the rest of the functions subscribed to Store.changed do not get fired. This might be more of an issue with Signal.
Is there any way I can ensure that the store update flush will continue even if one of the subscription functions throws an error? I don't want my entire game to break because of one error being thrown.
The text was updated successfully, but these errors were encountered:
A trivial fix for this would be to call each listener in a separate thread, but that doesn't fit with the spec file since listeners are meant to be called in order. Spawning the listeners in separate threads would not guarantee order.
An alternative would be to catch errors with a pcall and then throw them as errors in separate threads:
But this is expensive and doesn't seem to fit what Rodux is going for.
You could stop here and say "just do proper error handling in your listeners," which is fine, but I have a couple qualms about that.
It doesn't fit the pattern set forth by RBXScriptSignal connections. This library is patterned after Redux, so it would make sense to not necessarily follow the norms set forth by Roblox, but Roblox conventions still remain a valid consideration.
Leaving error handling entirely up to the developer is not always the best course of action. I could simply pcall all my listeners, but that would be clunky and not an ideal setup for actually handling problems. I could try to handle every single error that could pop up, which I do. But I have run into issues in production that I didn't predict or test for. This can cause serious problems because the errors cascade and block other important behavior from executing.
I've noticed that whenever an error is thrown from a function subscribed to
Store.changed
, the execution is stopped and the rest of the functions subscribed toStore.changed
do not get fired. This might be more of an issue withSignal
.Is there any way I can ensure that the store update flush will continue even if one of the subscription functions throws an error? I don't want my entire game to break because of one error being thrown.
The text was updated successfully, but these errors were encountered: