I have a problem in a Symfony 4.4 application where there are a dozen listeners listening to a single event that extends Symfony\Contracts\EventDispatcher\Event
. The problem is that if one of the listeners throws an exception, then none of the listeners that come after it are executed.
I was looking for a way to catch exceptions from listeners so that this doesn't occur. I tried extending Symfony\Component\EventDispatcher\EventDispatcher
and overriding the callListeners()
method to include a try
/catch
so that I could log the exception but continue the execution. But I don't know how to tell Symfony to use my EventDispatcher
instead of its own.
I don't know if that's even a recommendable way of solving this problem. Any idea of how I could get this to work, or if there are any other alternatives?