<commit_before>/* Chrome Linux plugin
*
* This software is released under either the GNU Library General Public
* License (see LICENSE.LGPL).
*
* Note that the only valid version of the LGPL license as far as this
* project is concerned is the original GNU Library General Public License
* Version 2.1, February 1999
*/


#include "IOCommunicator.h"
#include "jsonxx.h"
#include "RequestHandler.h"
#include "Logger.h"
#include "HostExceptions.h"

using namespace std;
using namespace jsonxx;

int main(int argc, char **argv) {

	IOCommunicator ioCommunicator;

	while (true)
	{
		_log("Parsing input...");
		string response;
		try
		{
			string request = ioCommunicator.readMessage();
			RequestHandler handler(request);
			response = handler.handleRequest().json();
		}
		catch (BaseException &e)
		{
			string msg = "Handling exception: " + e.getErrorCode();
			_log(msg.c_str());
			Object json;
			json << "result" << e.getErrorCode() << "message" << e.getErrorMessage();
			response = json.json();
		}
		catch (const std::runtime_error &e)
		{
			Object json;
			json << "result" << "invalid_argument" << "message" << e.what();
			response = json.json();
		}
		ioCommunicator.sendMessage(response);
	}
	return EXIT_SUCCESS;
}
<commit_msg>Ending windows host process in case of errors<commit_after>/* Chrome Linux plugin
*
* This software is released under either the GNU Library General Public
* License (see LICENSE.LGPL).
*
* Note that the only valid version of the LGPL license as far as this
* project is concerned is the original GNU Library General Public License
* Version 2.1, February 1999
*/


#include "IOCommunicator.h"
#include "jsonxx.h"
#include "RequestHandler.h"
#include "Logger.h"
#include "HostExceptions.h"

using namespace std;
using namespace jsonxx;

int main(int argc, char **argv) {

	IOCommunicator ioCommunicator;

	while (true)
	{
		_log("Parsing input...");
		try
		{
			string request = ioCommunicator.readMessage();
			RequestHandler handler(request);
			string response = handler.handleRequest().json();
			ioCommunicator.sendMessage(response);
		}
		catch (BaseException &e)
		{
			string msg = "Handling exception: " + e.getErrorCode();
			_log(msg.c_str());
			Object json;
			json << "result" << e.getErrorCode() << "message" << e.getErrorMessage();
			string response = json.json();
			ioCommunicator.sendMessage(response);
			break;
		}
		catch (const std::runtime_error &e)
		{
			Object json;
			json << "result" << "invalid_argument" << "message" << e.what();
			string response = json.json();
			ioCommunicator.sendMessage(response);
			break;
		}
	}
	return EXIT_SUCCESS;
}

{'fraction_non_alphanumeric': 0.12695386961494473, 'fraction_numerical': 0.004574914220358368, 'mean_word_length': 4.125, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 3, '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': '2859321', 'n_tokens_mistral': 909, 'n_tokens_neox': 808, 'n_words': 248}