catch generateFunc errors. Closes #83