Catch exception in markdown card

I’m using a markdown card to display my domains. It’s pretty slick and looks like this.
image
It works like this:

On startup it causes a bunch of exceptions in the logs while initializing. So I’d like to try to catch those exceptions. How do I do that in a markdown card? I tried this and several variations, but the card always goes blank and stops working.

{%- for d in states | groupby('domain') %}
  {% try: %}
    {{ d[0] }}: {{d[0]|count}}
  {% except yaml.YAMLError, exc: }
{%- endfor %}

Does anyone have suggestions?