{% if errors|default([])|length > 0 %}
<div class="form-errors invalid-feedback js-form-validation__errors {{ className|default('') }}">
<ul>
{% for error in errors|default([]) %}
{% if error is instanceof('\\Symfony\\Component\\Form\\FormError') %}
<li>{{ error.message }}</li>
{% else %}
<li>{{ error|trans }}</li>
{% endif %}
{% endfor %}
</ul>
</div>
{% else %}
{# Make sure there are no whitespaces inside an empty form-errors. Otherwise :empty does not work correctly #}
<div class="form-errors invalid-feedback js-form-validation__errors {{ className|default('') }}"></div>
{% endif %}