<commit_before>module.exports = function (sails) {


	return {

		/**
		 * Default 500 handler.
		 * 
		 * @param  {[type]} err [description]
		 * @param  {[type]} req [description]
		 * @param  {[type]} res [description]
		 * @return {[type]}     [description]
		 */
		500: function (err, req, res) {
			try {
				if ( typeof sails.config[500] === 'function' ) {
					sails.log.warn('sails.config[500] (i.e. `config/500.js`) has been superceded in Sails v0.10 by the `serverError.js` blueprint.');
					sails.log.warn('sails.config[500] will be deprecated in an upcoming release.');
					sails.log.warn('Please use the serverError blueprint instead. (i.e. api/blueprints/errors/serverError.js)');
					return sails.config[500](err, req, res);
				}

				if ( typeof (sails.blueprints && sails.blueprints.serverError) === 'function' ) {
					return sails.blueprints.serverError(err, req, res);
				}
				
				// Log an error and try to use `res.send` to respond.
				sails.log.error('An error occurred in a request, but no error handler is configured.');
				sails.log.error(err);
				res.send(err, 500);
				return;
			}
			catch(e) {
				sails.log.error('A request reached the default `serverError` (aka 500) handler in Sails... but no response could be sent!');
				sails.log.error('Here\'s the error Sails encountered:\n', e);
				return;
			}
		},



		/**
		 * Default 404 handler.
		 * 
		 * @param  {[type]} req [description]
		 * @param  {[type]} res [description]
		 * @return {[type]}     [description]
		 */
		404: function (req, res) {
			try {
				if ( typeof sails.config[404] === 'function' ) {
					sails.log.warn('sails.config[404] (i.e. `config/404.js`) has been superceded in Sails v0.10 by the `notFound.js` blueprint.');
					sails.log.warn('sails.config[404] will be deprecated in an upcoming release.');
					sails.log.warn('Please use the notFound blueprint instead. (i.e. api/blueprints/errors/notFound.js)');
					return sails.config[404](req, res);
				}

				if ( typeof (sails.blueprints && sails.blueprints.notFound) === 'function' ) {
					return sails.blueprints.notFound(req, res);
				}

				// Log a message and try to use `res.send` to respond.
				res.send(404);
				sails.log.verbose('A request did not match any routes, and no notFound handler is configured.');
				return;
			}<commit_msg>Look in sails.errors for res.serverError definition, etc. (instead of sails.blueprints).<commit_after>module.exports = function (sails) {


	return {

		/**
		 * Default 500 handler.
		 * 
		 * @param  {[type]} err [description]
		 * @param  {[type]} req [description]
		 * @param  {[type]} res [description]
		 * @return {[type]}     [description]
		 */
		500: function (err, req, res) {
			try {
				if ( typeof sails.config[500] === 'function' ) {
					sails.log.warn('sails.config[500] (i.e. `config/500.js`) has been superceded in Sails v0.10 by the `serverError.js` blueprint.');
					sails.log.warn('sails.config[500] will be deprecated in an upcoming release.');
					sails.log.warn('Please use the serverError blueprint instead. (i.e. api/blueprints/errors/serverError.js)');
					return sails.config[500](err, req, res);
				}

				if ( typeof (sails.errors && sails.errors.serverError) === 'function' ) {
					return sails.errors.serverError(err, req, res);
				}
				
				// Log an error and try to use `res.send` to respond.
				sails.log.error('An error occurred in a request, but no error handler is configured.');
				sails.log.error(err);
				res.send(err, 500);
				return;
			}
			catch(e) {
				sails.log.error('A request reached the default `serverError` (aka 500) handler in Sails... but no response could be sent!');
				sails.log.error('Here\'s the error Sails encountered:\n', e);
				return;
			}
		},



		/**
		 * Default 404 handler.
		 * 
		 * @param  {[type]} req [description]
		 * @param  {[type]} res [description]
		 * @return {[type]}     [description]
		 */
		404: function (req, res) {
			try {
				if ( typeof sails.config[404] === 'function' ) {
					sails.log.warn('sails.config[404] (i.e. `config/404.js`) has been superceded in Sails v0.10 by the `notFound.js` blueprint.');
					sails.log.warn('sails.config[404] will be deprecated in an upcoming release.');
					sails.log.warn('Please use the notFound blueprint instead. (i.e. api/blueprints/errors/notFound.js)');
					return sails.config[404](req, res);
				}

				if ( typeof (sails.errors && sails.errors.notFound) === 'function' ) {
					return sails.errors.notFound(req, res);
				}

				// Log a message and try to use `res.send` to respond.
				res.send(404);
				sails.log.verbose('A request did not match any routes, and no notFound handler is configured.');
				return;
			}
{'fraction_non_alphanumeric': 0.15453194650817237, 'fraction_numerical': 0.024198683931224794, 'mean_word_length': 2.983093829247675, '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': '4648560', 'n_tokens_mistral': 1937, 'n_tokens_neox': 1524, 'n_words': 435}