throw error if updating fails