<commit_before>( function (mw, $, WL) {

	var Server = function () {};
	Server.prototype.request = function (relPath, data) {
		var deferred = $.Deferred();

		$.ajax(
			this.absPath.apply(this, relPath),
			{
				dataType: "jsonp",
				crossDomain: true,
				data: data || {}
			}
		)
			.done(function (doc, status, jqXHR) {
				if (!doc.error) {
					deferred.resolve(doc);
				} else {
					console.error(doc.error);
					deferred.reject(doc.error);
				}
			}.bind(this))
			.fail(function (jqXHR, status, err) {
				var errorData = { code: status, message: err };
				console.error(errorData);
				deferred.reject(errorData);
			}.bind(this));

		return deferred.promise();
	};
	Server.prototype.absPath = function(/* relative path parts */){
		var serverRoot = WL.config.serverRoot,
		    relPath = WL.util.pathJoin.apply(this, Array.prototype.slice.call(arguments));

		return serverRoot.replace(/\/+$/g, "") + "/" + relPath.replace(/^\/+/g, "") + "/";
	};<commit_msg>Proper client side error logging.<commit_after>( function (mw, $, WL) {

	var Server = function () {};
	Server.prototype.request = function (relPath, data) {
		var deferred = $.Deferred();

		$.ajax(
			this.absPath.apply(this, relPath),
			{
				dataType: "jsonp",
				crossDomain: true,
				data: data || {}
			}
		)
			.done(function (doc, status, jqXHR) {
				if (!doc.error) {
					deferred.resolve(doc);
				} else {
					console.error(doc.error);
					deferred.reject(doc.error);
				}
			}.bind(this))
			.fail(function (jqXHR, status, err) {
				var errorData = { code: jqXHR.status, status: status, message: err };
				console.error(errorData);
				deferred.reject(errorData);
			}.bind(this));

		return deferred.promise();
	};
	Server.prototype.absPath = function(/* relative path parts */){
		var serverRoot = WL.config.serverRoot,
		    relPath = WL.util.pathJoin.apply(this, Array.prototype.slice.call(arguments));

		return serverRoot.replace(/\/+$/g, "") + "/" + relPath.replace(/^\/+/g, "") + "/";
	};
{'fraction_non_alphanumeric': 0.18537074148296592, 'fraction_numerical': 0.0, 'mean_word_length': 3.1006160164271046, 'pattern_counts': {'":': 0, '<': 3, '<?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': '3130105', 'n_tokens_mistral': 825, 'n_tokens_neox': 676, 'n_words': 132}