<commit_before><?php

/**
 * A filter that catches all exceptions in AJAX requests
 * and converts them to a JSON error response.
 */
class ExceptionCatchingFilter extends sfFilter
{
	public function execute ($filterChain)
	{
            
		$request = $this->context->getRequest();
		if($request->isXmlHttpRequest() && $this->isFirstCall())
		{
                    
                    $debugMode = sfConfig::get('sf_debug');
			try {
				$filterChain->execute();
			} catch (sfException $e) {
				throw $e;
			} catch (PropelException $e) {
                            $cause = $e->getCause();
                            if ($cause->getCode() == 23000) {
                                if (!$debugMode) {
                                    $message = 'You are probably trying to delete or update a record that have other related records.';
                                }
                            } else if (!$debugMode) {
                                error_log('PropelException: '.$e->getMessage());
                                $message = 'A database error occured.';
                            }
                            if (!isset($message)) {
                                $message = $e->getMessage();
                            }
                            $this->injectErrorIntoResponse($message);
			} catch (Exception $e) {
                            if ($debugMode) {
                                $errorMessage = $e->getMessage();
                            } else {
                                error_log('Exception: '.$e->getMessage());
                                $errorMessage = 'Some unexpected error occured.';
                            }<commit_msg>Little change towards more defensive code<commit_after><?php

/**
 * A filter that catches all exceptions in AJAX requests
 * and converts them to a JSON error response.
 */
class ExceptionCatchingFilter extends sfFilter
{
	public function execute ($filterChain)
	{
            
		$request = $this->context->getRequest();
		if($request->isXmlHttpRequest() && $this->isFirstCall())
		{
                    
                    $debugMode = sfConfig::get('sf_debug');
			try {
				$filterChain->execute();
			} catch (sfException $e) {
				throw $e;
			} catch (PropelException $e) {
                            $cause = $e->getCause();
                            if ($cause && $cause->getCode() == 23000) {
                                if (!$debugMode) {
                                    $message = 'You are probably trying to delete or update a record that have other related records.';
                                }
                            } else if (!$debugMode) {
                                error_log('PropelException: '.$e->getMessage());
                                $message = 'A database error occured.';
                            }
                            if (!isset($message)) {
                                $message = $e->getMessage();
                            }
                            $this->injectErrorIntoResponse($message);
			} catch (Exception $e) {
                            if ($debugMode) {
                                $errorMessage = $e->getMessage();
                            } else {
                                error_log('Exception: '.$e->getMessage());
                                $errorMessage = 'Some unexpected error occured.';
                            }
{'fraction_non_alphanumeric': 0.109465737514518, 'fraction_numerical': 0.0029036004645760743, 'mean_word_length': 1.1213054187192117, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '518280', 'n_tokens_mistral': 835, 'n_tokens_neox': 769, 'n_words': 196}