<commit_before>function insert(action, url, form_data)
{
	var content = $('#main').html();
	$('div#main').remove();
	$('#loader').show();

	if(action == 'step1')
	{
		$('div#main').remove();
		$('#loader').show();
		
		$.ajax({
			url: url,
			type: 'POST',
			data: form_data,
			success: function(val) {
				
				$('#loader').hide();
				$('#content').html(val);
				
				return false;
			
			},
			
			error: function(err, desc, val) {
				
				var error = '<div id="error" style=" display: block; ">' + val + '</div>';
				var initial_content = '<div id="main">' + content + '</div>';
				$('#loader').hide();
				$('#content').html(error);
				$('#content').append(initial_content);
				
				return false;
			
			}
			
		});
		
	}

	if(action == 'step2')
	{

		$('div#main').remove();
		$('#loader').show();
		
		$.ajax({
			url: url,
			type: 'POST',
			data: form_data,
			success: function(val) {
				
				$('#loader').hide();
				$('#content').html(val);
				
				return false;
			
			}
			
		});
		
	}

	if(action == 'step3')
	{

		$('div#main').remove();
		$('#loader').show();
		
		$.ajax({
			url: url,
			type: 'POST',
			data: form_data,
			success: function(val) {
				
				$('#loader').hide();
				$('#content').html(val);
				
				return false;
			
			}
			
		});
		
	}

	if(action == 'step4')
	{
		$('div#main').remove();
		$('#loader').show();
		
		$.ajax({
			url: url,
			type: 'POST',
			data: form_data,
			success: function(val) {
				
				$('#loader').hide();
				$('#content').html(val);
				
				return false;
			
			}
		
		});
		
	}

	if(action == 'step5')
	{
		$('div#main').remove();
		$('#loader').show();
		
		$.ajax({
			url: url,
			type: 'POST',
			data: form_data,
			success: function(val) {
				$('#loader').hide();
				$('#content').html(val);
				
				return false;
			
			}
			
		});
		
	}

	if(action == 'step6')
	{
		$('div#main').remove();
		$('#loader').show();
		
		$.ajax({
			url: url,
			type: 'POST',
			data: form_data,
			success: function(val) {
				$('#loader').hide();
				$('#content').html(val);
				
				return false;
			
			}
			
		});
		
	}

	if(action == 'step7')
	{
		$('div#main').remove();
		$('#loader').show();
		
		$.ajax({
			url: url,
			type: 'POST',
			data: form_data,
			success: function(val) {
				$('#loader').hide();
				$('#content').html(val);
				
				return false;
			
			}
			
		});
		
	}

}

function view(action, url, form_data)<commit_msg>Handling errors returned by ajax requests<commit_after>function insert(action, url, form_data)
{
	var content = $('#main').html();
	$('div#main').remove();
	$('#loader').show();

	if(action == 'step1')
	{
		$('div#main').remove();
		$('#loader').show();
		
		$.ajax({
			url: url,
			type: 'POST',
			data: form_data,
			success: function(val) {
				
				$('#loader').hide();
				$('#content').html(val);
				
				return false;
			
			},
			
			error: function(err, desc, val) {
				
				var error = '<div id="error" style=" display: block; ">' + val + '</div>';
				var initial_content = '<div id="main">' + content + '</div>';
				$('#loader').hide();
				$('#content').html(error);
				$('#content').append(initial_content);
				
				return false;
			
			}
			
		});
		
	}

	if(action == 'step2')
	{

		$('div#main').remove();
		$('#loader').show();
		
		$.ajax({
			url: url,
			type: 'POST',
			data: form_data,
			success: function(val) {
				
				$('#loader').hide();
				$('#content').html(val);
				
				return false;
			
			},
			
			error: function(err, desc, val) {
				
				var error = '<div id="error" style=" display: block; ">' + val + '</div>';
				var initial_content = '<div id="main">' + content + '</div>';
				$('#loader').hide();
				$('#content').html(error);
				$('#content').append(initial_content);
				
				return false;
			
			}
			
		});
		
	}

	if(action == 'step3')
	{

		$('div#main').remove();
		$('#loader').show();
		
		$.ajax({
			url: url,
			type: 'POST',
			data: form_data,
			success: function(val) {
				
				$('#loader').hide();
				$('#content').html(val);
				
				return false;
			
			},
			
			error: function(err, desc, val) {
				
				var error = '<div id="error" style=" display: block; ">' + val + '</div>';
				var initial_content = '<div id="main">' + content + '</div>';
				$('#loader').hide();
				$('#content').html(error);
				$('#content').append(initial_content);
				
				return false;
			
			}
			
		});
		
	}

	if(action == 'step4')
	{
		$('div#main').remove();
		$('#loader').show();
		
		$.ajax({
			url: url,
			type: 'POST',
			data: form_data,
			success: function(val) {
				
				$('#loader').hide();
				$('#content').html(val);
				
				return false;
			
			},
			
			error: function(err, desc, val) {
				
				var error = '<div id="error" style=" display: block; ">' + val + '</div>';
				var initial_content = '<div id="main">' + content + '</div>';
				$('#loader').hide();
				$('#content').html(error);
				$('#content').append(initial_content);
				
				return false;
			
			}
		
		});
		
	}

	if(action == 'step5')
	{
		$('div#main').remove();
		$('#loader').show();
		
		$.ajax({
			url: url,
			type: 'POST',
			data: form_data,
			success: function(val) {
				$('#loader').hide();
				$('#content').html(val);
				
				return false;
			
			},
			
			error: function(err, desc, val) {
				
				var error = '<div id="error" style=" display: block; ">' + val + '</div>';
				var initial_content = '<div id="main">' + content + '</div>';
				$('#loader').hide();
				$('#content').html(error);
				$('#content').append(initial_content);
				
				return false;
			
			}
			
		});
		
	}

	if(action == 'step6')
	{
		$('div#main').remove();
		$('#loader').show();
		
		$.ajax({
			url: url,
			type: 'POST',
			data: form_data,
			success: function(val) {
				$('#loader').hide();
				$('#content').html(val);
				
				return false;
			
			},
			
			error: function(err, desc, val) {
				
				var error = '<div id="error" style=" display: block; ">' + val + '</div>';
				var initial_content = '<div id="main">' + content + '</div>';
				$('#loader').hide();
				$('#content').html(error);
				$('#content').append(initial_content);
				
				return false;
			
			}
			
		});
		
	}

	if(action == 'step7')
	{
		$('div#main').remove();
		$('#loader').show();
		
		$.ajax({
			url: url,
			type: 'POST',
			data: form_data,
			success: function(val) {
				$('#loader').hide();
				$('#content').html(val);
				
				return false;
			
			},
			
			error: function(err, desc, val) {
				
				var error = '<div id="error" style=" display: block; ">' + val + '</div>';
				var initial_content = '<div id="main">' + content + '</div>';
				$('#loader').hide();
				$('#content').html(error);
				$('#content').append(initial_content);
				
				return false;
			
			}
			
		});
		
	}

}

function view(action, url, form_data)
{'fraction_non_alphanumeric': 0.2438380281690141, 'fraction_numerical': 0.0020539906103286387, 'mean_word_length': 2.432527693856999, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6111593', 'n_tokens_mistral': 3174, 'n_tokens_neox': 2369, 'n_words': 460}