catch and log generic exceptions when creating invoices

fixes http://manage.dimagi.com/default.asp?111426#628776