<commit_before>"use strict";

const Nodest = require("nodest");
const Statuses = require("statuses");

class ApiController extends Nodest.Controller {

	/**
	* Using API formatting, send an http.ServerResponse indicating there was an Internal Server Error (500)
	* @param {string|Object} msg Error message to send
	* @param {Object} details Any additional details for the error (must be serializable)
	* @return {boolean}
	*/
	error(msg, status, stack) {
		status = status || 500;
		var err = Statuses[status];
		this.status(status);
		
		//if (typeof msg === 'object') {
		//	msg = JSON.stringify(msg);	
		//}
		
		this.log.error(msg);
		
		this.render(Nodest.API.error(status, err, msg));
		return true;
	}

}

module.exports = ApiController;<commit_msg>updated docs and fixed a bug<commit_after>"use strict";

const Nodest = require("nodest");
const Statuses = require("statuses");

class ApiController extends Nodest.Controller {

	/**
	* Using API formatting, send an http.ServerResponse indicating there was an error
	* @param {string|Object} msg Error message to send
	* @param {int} status Status of the error to send
	* @param {Object} stack Stack trace of error
	* @return {boolean}
	*/
	error(msg, status, stack) {
		status = status || 500;
		var err = Statuses[status];
		this.ctx.status = status;
		
		//if (typeof msg === 'object') {
		//	msg = JSON.stringify(msg);	
		//}
		
		this.log.error(msg);
		
		this.render(Nodest.API.error(status, err, msg));
		return true;
	}

}

module.exports = ApiController;
{'fraction_non_alphanumeric': 0.1355263157894737, 'fraction_numerical': 0.0059210526315789476, 'mean_word_length': 3.875, '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': '2444407', 'n_tokens_mistral': 527, 'n_tokens_neox': 480, 'n_words': 148}