Ah, it is working because of this check: https://github.com/yiisoft/yii2/blob/refactor-errorhandler/framework/base/ErrorHandler.php#L134