(Bug 5085) Stringify the error object from template toolkit

So that our own exception handling will know what to do with it.