updates api call error handling