add some error catching for api request