<commit_before><?php

namespace Doctrine\CouchDB\HTTP;

/**
 * Base exception class for package Doctrine\ODM\CouchDB\HTTP
 *
 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
 * @link        www.doctrine-project.com
 * @since       1.0
 * @author      <NAME> <<EMAIL>>
 */
class HTTPException extends \Doctrine\CouchDB\CouchDBException
{
    public static function connectionFailure( $ip, $port, $errstr, $errno )
    {
        return new self( sprintf(
            "Could not connect to server at %s:%d: '%d: %s'",
            $ip,
            $port,
            $errno,
            $errstr
        ) );
    }

    public static function readFailure( $ip, $port, $errstr, $errno )
    {
        return new static( sprintf(
            "Could read from server at %s:%d: '%d: %s'",
            $ip,
            $port,
            $errno,
            $errstr
        ) );
    }

    /**
     * @param Response $response
     */
    public static function fromResponse($path, Response $response)
    {
        if (!isset($response->body['error'])) {
            $response->body['error'] = '';
        }

        return new self("HTTP Error with status " . $response->status . " occoured while ".
            "requesting " . $path . ". Error: " . $response->body['error'] . " " . $response->body['reason']);
    }
}
<commit_msg>Set exception code to status of HTTP response<commit_after><?php

namespace Doctrine\CouchDB\HTTP;

/**
 * Base exception class for package Doctrine\ODM\CouchDB\HTTP
 *
 * @license     http://www.opensource.org/licenses/lgpl-license.php LGPL
 * @link        www.doctrine-project.com
 * @since       1.0
 * @author      <NAME> <<EMAIL>>
 */
class HTTPException extends \Doctrine\CouchDB\CouchDBException
{
    public static function connectionFailure( $ip, $port, $errstr, $errno )
    {
        return new self( sprintf(
            "Could not connect to server at %s:%d: '%d: %s'",
            $ip,
            $port,
            $errno,
            $errstr
        ),
	$errno );
    }

    public static function readFailure( $ip, $port, $errstr, $errno )
    {
        return new static( sprintf(
            "Could read from server at %s:%d: '%d: %s'",
            $ip,
            $port,
            $errno,
            $errstr
        ),
	$errno );
    }

    /**
     * @param Response $response
     */
    public static function fromResponse($path, Response $response)
    {
        if (!isset($response->body['error'])) {
            $response->body['error'] = '';
        }

        return new self("HTTP Error with status " . $response->status . " occoured while ".
            "requesting " . $path . ". Error: " . $response->body['error'] . " " . $response->body['reason'],
		$response->status
	);
    }
}

{'fraction_non_alphanumeric': 0.14817491868449584, 'fraction_numerical': 0.0014456089627755693, 'mean_word_length': 1.9260042283298098, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '6260749', 'n_tokens_mistral': 828, 'n_tokens_neox': 830, 'n_words': 206}