[ticket/13361] Improve the exception listener

PHPBB3-13361