[ticket/13361] Improve the exception listener

https://tracker.phpbb.com/browse/PHPBB3-13361

PHPBB3-13361