wrap output generator call in try-catch block