Fixes bot shutdown if event payload decode fails.
@@ -171,5 +171,14 @@ class EventManager(typing.Generic[EventDispatcherT], raw_event_consumers.RawEven
except KeyError:
self.logger.debug("no handler for event %s is registered", name)
else:
+ try:
event = handler(shard_client_obj, payload)
+ except Exception as ex:
+ self.logger.exception(
+ "Failed to unmarshal %r event payload. This is likely a bug in Hikari itself. "
+ "Please contact a library dev or make an issue on the issue tracker for more support.",
+ name,
+ exc_info=ex,
+ )
+ else:
self.event_dispatcher.dispatch_event(event)
