<commit_before>/* Redirect Route implementation */

var prettified = require('prettified');
var http = require('http');
var HTTPError = require('../HTTPError.js');

module.exports = function(err) {
	var f = function(req, res) {
		try {
			if(err instanceof HTTPError) {
				res.status(err.code);
				Object.keys(err.headers).forEach(function(key) {
					res.header(key, err.headers[key]);
				});
				res.render('error', {'message':err.message});
			} else {
				prettified.errors.print(err);
				res.status(500);
				res.render('error', {'message':'Virhe tapahtui!'});
			}
		} catch (err2) {
			prettified.errors.print(err2);
			res.send('Odottamaton virhe tapahtui!');
		}
	};

	/*
	code = code || 500;
	msg = msg || http.STATUS_CODES[code] || 'Internal Server Error';
	var f = function(req, res) {
		prettified.errors.print(err); // FIXME: preffified failing to print stderr correctly
		// FIXME: Implement better error for browser
		res.send(code, msg);
	};
	*/

	return f;<commit_msg>Changed finnish messages to english<commit_after>/* Redirect Route implementation */

var prettified = require('prettified');
var http = require('http');
var HTTPError = require('../HTTPError.js');

module.exports = function(err) {
	var f = function(req, res) {
		try {
			if(err instanceof HTTPError) {
				res.status(err.code);
				Object.keys(err.headers).forEach(function(key) {
					res.header(key, err.headers[key]);
				});
				res.render('error', {'message':err.message});
			} else {
				prettified.errors.print(err);
				res.status(500);
				res.render('error', {'message':'Internal Server Error'});
			}
		} catch (err2) {
			prettified.errors.print(err2);
			res.send('Unexpected error!');
		}
	};

	/*
	code = code || 500;
	msg = msg || http.STATUS_CODES[code] || 'Internal Server Error';
	var f = function(req, res) {
		prettified.errors.print(err); // FIXME: preffified failing to print stderr correctly
		// FIXME: Implement better error for browser
		res.send(code, msg);
	};
	*/

	return f;
{'fraction_non_alphanumeric': 0.16966966966966968, 'fraction_numerical': 0.008008008008008008, 'mean_word_length': 3.7482185273159145, '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': '727643', 'n_tokens_mistral': 769, 'n_tokens_neox': 686, 'n_words': 147}