# HttpSoft\Basis exceptions

The HttpSoft\Basis package exception classes.

# HttpSoft\Basis\Exception\HttpException

The basic exception is HttpSoft\Basis\Exception\HttpException.

public function __construct(
    int $statusCode, 
    string $reasonPhrase = null, 
    Throwable $previous = null
);

If $reasonPhrase is not specified and the status code is one of the assigned error codes (4xx or 5xx), then the corresponding reason phrase will be used.

Expands the original \Exception. Contains three additional methods:

/**
 * Gets the HTTP status code, such as 403, 404, 500, etc.
 *
 * @return int
 */
public function getStatusCode(): int;

/**
 * Gets the reason phrase, such as "Forbidden", "Not Found", etc.
 *
 * @return string
 */
public function getReasonPhrase(): string;

/**
 * Gets a string consisting of the status code and the reason phrase,
 * such as "403 Forbidden", "404 Not Found", etc.
 *
 * @return string
 */
public function getTitle(): string;

# Custom exceptions

For convenience, several exceptions have been added for specific, most common errors.

Custom exceptions extend HttpSoft\Basis\Exception\HttpException, but the HTTP status code is pre-set and cannot be changed.

public function __construct(
    string $reasonPhrase = null, 
    Throwable $previous = null
);

If $reasonPhrase is not specified, the reason phrase corresponding to the status code will be used.

All custom exceptions: