Wrap call to the rest api with try-except while generating report