SMAPI - Stardew Modding API

SMAPI - Stardew Modding API

971k Downloads

Make events more robust

Pathoschild opened this issue ยท 1 comments

commented

There are two issues with the way SMAPI raises events:

  • An exception thrown by some event handlers immediately crashes the game with no error in the log.
    Many events have no error-handling. This means exceptions bubble up into the game or XNA, which then crashes with no error in the log. This notably affects GameEvents.GameLoaded.
  • An exception thrown by any event handler prevents other mods from receiving the event.
    An error in one mod's handler means every other mod won't be notified. For example, let's say ModA and ModB both subscribed to GameEvents.Initialize; if ModA's handler throws an exception, ModB's handler will never be called.
commented

Done in the upcoming 1.2 release. SMAPI now invokes each handler with its own error-handling, which means event handlers will never crash the game and will no longer prevent other handlers from being invoked.