HttpException extends Exception
Base class for all HTTP error exceptions.
Subclasses only declare their default reason phrase and status code through
the HttpException::DEFAULT_MESSAGE and HttpException::DEFAULT_CODE
constants; the constructor resolves them via late static binding, so a bare
new ErrorXXX() carries the right defaults while every argument stays
overridable. Catch this type to handle any HTTP error at once.
Tags
Table of Contents
Constants
- DEFAULT_CODE : int = 0
- The default HTTP status code of the exception.
- DEFAULT_MESSAGE : string = 'HTTP Error'
- The default message of the exception.
Methods
- __construct() : mixed
- Creates a new HttpException instance.
Constants
DEFAULT_CODE
The default HTTP status code of the exception.
public
int
DEFAULT_CODE
= 0
DEFAULT_MESSAGE
The default message of the exception.
public
string
DEFAULT_MESSAGE
= 'HTTP Error'
Methods
__construct()
Creates a new HttpException instance.
public
__construct([string|null $message = null ][, int|null $code = null ][, Throwable|null $previous = null ]) : mixed
Parameters
- $message : string|null = null
-
The error message, or null to use the class default.
- $code : int|null = null
-
The HTTP status code, or null to use the class default.
- $previous : Throwable|null = null
-
The previous throwable used for exception chaining.