<commit_before><?php

/**
 * @copyright  <NAME>
 * @license    http://www.makoframework.com/license
 */

namespace mako\core\error\handlers;

use \Exception;
use \ErrorException;
use \mako\http\Request;
use \mako\http\Response;
use \mako\http\RequestException;

/**
 * Web handler.
 * 
 * @author  <NAME>
 */

class CLIHandler extends \mako\core\error\handlers\Handler implements \mako\core\error\handlers\HandlerInterface
{
	//---------------------------------------------
	// Class properties
	//---------------------------------------------

	// Nothing here

	//---------------------------------------------
	// Class constructor, destructor etc ...
	//---------------------------------------------

	// Nothing here

	//---------------------------------------------
	// Class methods
	//---------------------------------------------

	/**
	 * Returns a detailed error.
	 * 
	 * @access  protected
	 * @return  string
	 */

	protected function getDetailedError()
	{
		echo $this->exception->getMessage() . PHP_EOL;
	}

	/**
	 * Retruns a generic error.
	 * 
	 * @access  protected
	 * @return  string
	 */

	protected function getGenericError()
	{
		echo 'An error has occurred while processing your task.' . PHP_EOL;
	}

	/**
	 * Handles the exception.
	 * 
	 * @access  public
	 * @param   boolean  $showDetails  (optional) Show error details?
	 * @return  boolean
	 */

	public function handle($showDetails = true)
	{
		// Set the response body

		if($showDetails)
		{
			$this->getDetailedError();
		}
		else
		{
			$this->getGenericError();
		}

		// Return false to stop further error handling

		return false;
	}
}<commit_msg>Send errors to stderr<commit_after><?php

/**
 * @copyright  <NAME>
 * @license    http://www.makoframework.com/license
 */

namespace mako\core\error\handlers;

/**
 * CLI handler.
 * 
 * @author  <NAME>
 */

class CLIHandler extends \mako\core\error\handlers\Handler implements \mako\core\error\handlers\HandlerInterface
{
	//---------------------------------------------
	// Class properties
	//---------------------------------------------

	// Nothing here

	//---------------------------------------------
	// Class constructor, destructor etc ...
	//---------------------------------------------

	// Nothing here

	//---------------------------------------------
	// Class methods
	//---------------------------------------------

	/**
	 * Returns a detailed error.
	 * 
	 * @access  protected
	 * @return  string
	 */

	protected function getDetailedError()
	{
		fwrite(STDERR, $this->exception->getMessage() . PHP_EOL . $this->exception->getTraceAsString() . PHP_EOL);
	}

	/**
	 * Retruns a generic error.
	 * 
	 * @access  protected
	 * @return  string
	 */

	protected function getGenericError()
	{
		fwrite(STDERR, 'An error has occurred while processing your task.' . PHP_EOL);
	}

	/**
	 * Handles the exception.
	 * 
	 * @access  public
	 * @param   boolean  $showDetails  (optional) Show error details?
	 * @return  boolean
	 */

	public function handle($showDetails = true)
	{
		// Set the response body

		if($showDetails)
		{
			$this->getDetailedError();
		}
		else
		{
			$this->getGenericError();
		}

		// Return false to stop further error handling

		return false;
	}
}
{'fraction_non_alphanumeric': 0.28178162697185277, 'fraction_numerical': 0.0, 'mean_word_length': 1.5424528301886793, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, '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': '4729411', 'n_tokens_mistral': 981, 'n_tokens_neox': 882, 'n_words': 213}