<commit_before>/*
	MIT License http://www.opensource.org/licenses/mit-license.php
	Author <NAME> @sokra
*/
var loaderFlag = "LOADER_EXECUTION";

function ModuleBuildError(module, err) {
	Error.call(this);
	Error.captureStackTrace(this, ModuleBuildError);
	this.name = "ModuleBuildError";
	this.message = "Module build failed: ";
	if(err !== null && typeof err === "object") {
		if(typeof err.stack === "string" && err.stack) {
			var stack = err.stack.split("\n");
			for(var i = 0; i < stack.length; i++)
				if(stack[i].indexOf(loaderFlag) >= 0)
					stack.length = i;
			stack = stack.join("\n");
			if(!err.hideStack) {
				this.message += stack;
			} else {
				this.details = stack;
				if(typeof err.message === "string" && err.message) {
					this.message += err.message;
				} else {
					this.message += err;
				}
			}
		} else if(typeof err.message === "string" && err.message) {
			this.message += err.message;
		} else {
			this.message += err;
		}
	}
	this.module = module;
	this.error = err;
}
module.exports = ModuleBuildError;

ModuleBuildError.prototype = Object.create(Error.prototype);
ModuleBuildError.prototype.constructor = ModuleBuildError;
<commit_msg>refactor(ModuleBuildError): upgrade to ES6<commit_after>/*
	MIT License http://www.opensource.org/licenses/mit-license.php
	Author <NAME> @sokra
*/
"use strict";

const loaderFlag = "LOADER_EXECUTION";

class ModuleBuildError extends Error {

	constructor(module, err) {
		super();
		if(Error.hasOwnProperty("captureStackTrace")) {
			Error.captureStackTrace(this, this.constructor);
		}
		this.name = "ModuleBuildError";
		this.message = "Module build failed: ";
		if(err !== null && typeof err === "object") {
			if(typeof err.stack === "string" && err.stack) {
				var stack = err.stack.split("\n");
				for(var i = 0; i < stack.length; i++)
					if(stack[i].indexOf(loaderFlag) >= 0)
						stack.length = i;
				stack = stack.join("\n");
				if(!err.hideStack) {
					this.message += stack;
				} else {
					this.details = stack;
					if(typeof err.message === "string" && err.message) {
						this.message += err.message;
					} else {
						this.message += err;
					}
				}
			} else if(typeof err.message === "string" && err.message) {
				this.message += err.message;
			} else {
				this.message += err;
			}
		}
		this.module = module;
		this.error = err;
	}
}

module.exports = ModuleBuildError;

{'fraction_non_alphanumeric': 0.16673648931713447, 'fraction_numerical': 0.0020946795140343527, 'mean_word_length': 3.2795698924731185, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4787774', 'n_tokens_mistral': 929, 'n_tokens_neox': 790, 'n_words': 167}