This is related to this question: How do you debug Mako templates?
One response mentions the built in debugging system in Mako and there's a comment about how it works well in Pyramid. However, I have no idea how you'd incorporate what is mentioned into Pyramid as you never call Mako's template rendering method directly.
There is a pyramid setting to catch mako exceptions.
A small pyramid extensions targeting mako exceptions in pyramid.
If you want to get in touch with mako rendering method directly, you can go for a mako preprocessor.
sample code for this approach.