I needed to debug an exception from deep inside a Jinja template the other day. I hacked this together and it helped.