add error handling for client api requests