More exception handling for api calls