<commit_before>class ErrorReporter < Controler
	self.define do
		on error Rack::UnhandledRequest::UnhandledRequestError do
			write_error 404, env['app.error']
		end

		on error Plugin::Thumbnailer::UnsupportedMediaTypeError do
			write_error 415, env['app.error']
		end

		on error(
			Plugin::Thumbnailer::ImageTooLargeError,
			MemoryLimit::MemoryLimitedExceededError
		)	do
			write_error 413, env['app.error']
		end

		on error(
			ThumbnailSpec::BadThubnailSpecError,
			Plugin::Thumbnailer::ZeroSizedImageError,
			Plugin::Thumbnailer::UnsupportedMethodError
		) do
			write_error 400, env['app.error']
		end

		log.error "unhandled error while processing request: #{env['REQUEST_METHOD']} #{env['SCRIPT_NAME']}[#{env["PATH_INFO"]}]", env['app.error']
		log.debug {
			out = StringIO.new
			PP::pp(env, out, 200)
			"Request: \n" + out.string
		}

		on error StandardError do
			write_error 500, env['app.error']
		end
	end
end
<commit_msg>using yielded error<commit_after>class ErrorReporter < Controler
	self.define do
		on error Rack::UnhandledRequest::UnhandledRequestError do |error|
			write_error 404, error
		end

		on error Plugin::Thumbnailer::UnsupportedMediaTypeError do |error|
			write_error 415, error
		end

		on error(
			Plugin::Thumbnailer::ImageTooLargeError,
			MemoryLimit::MemoryLimitedExceededError
		)	do |error|
			write_error 413, error
		end

		on error(
			ThumbnailSpec::BadThubnailSpecError,
			Plugin::Thumbnailer::ZeroSizedImageError,
			Plugin::Thumbnailer::UnsupportedMethodError
		) do |error|
			write_error 400, error
		end

		on error StandardError do |error|
			log.error "unhandled error while processing request: #{env['REQUEST_METHOD']} #{env['SCRIPT_NAME']}[#{env["PATH_INFO"]}]", error
			log.debug {
				out = StringIO.new
				PP::pp(env, out, 200)
				"Request: \n" + out.string
			}

			write_error 500, error
		end
	end
end

{'fraction_non_alphanumeric': 0.1127659574468085, 'fraction_numerical': 0.019148936170212766, 'mean_word_length': 4.631736526946108, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4876062', 'n_tokens_mistral': 773, 'n_tokens_neox': 637, 'n_words': 143}