<commit_before>#include <Poco/Ascii.h>
#include <Poco/Random.h>
#include <Poco/Exception.h>

#include "util/DAMM.h"
#include "model/GatewayID.h"

using namespace std;
using namespace Poco;
using namespace BeeeOn;

GatewayID::GatewayID(int version, uint64_t data)
{
	if (version <= 0 || version >= 10) {
		throw InvalidArgumentException(
			"invalid version, must be: 1 < version < 10");
	}

	string tmp;
	tmp.append(to_string(version));
	tmp.append(to_string(data));
	tmp.append(to_string(DAMM::compute(tmp)));

	m_value = stol(tmp);
}

GatewayID GatewayID::parse(const string &s)
{<commit_msg>GatewayID: catch std::exception and throw SyntaxException<commit_after>#include <Poco/Ascii.h>
#include <Poco/Random.h>
#include <Poco/Exception.h>

#include "util/DAMM.h"
#include "model/GatewayID.h"

using namespace std;
using namespace Poco;
using namespace BeeeOn;

GatewayID::GatewayID(int version, uint64_t data)
{
	if (version <= 0 || version >= 10) {
		throw InvalidArgumentException(
			"invalid version, must be: 1 < version < 10");
	}

	string tmp;
	tmp.append(to_string(version));
	tmp.append(to_string(data));
	tmp.append(to_string(DAMM::compute(tmp)));

	try {
		m_value = stol(tmp);
	} catch(exception &e) {
		throw SyntaxException("failed to stol: " + tmp);
	}
}

GatewayID GatewayID::parse(const string &s)
{
{'fraction_non_alphanumeric': 0.14935557240333586, 'fraction_numerical': 0.012130401819560273, 'mean_word_length': 5.470588235294118, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 11, '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': '5192171', 'n_tokens_mistral': 509, 'n_tokens_neox': 485, 'n_words': 109}