You are reading the documentation for the 1.x version. Switch to the current version 2.x.
HTTP exceptions
HttpException
class allow you to throw specific exception from context.
You can so define an HTTP status code and message.
By default, if an exception is throw, the framework generate an InternalServerErrorHttpException
exception with the
main exception in previous.
If you throw an HttpException
, the framework do not generate this exception and use yours, and the defined status code
and message.
Main exception
\Berlioz\HttpCore\Exception\HttpException
is the main exception used by the framework to generate errors to the user.
Children HTTP exceptions
For the most common HTTP exceptions, some class are already define in the namespace \Berlioz\HttpCore\Exception\Http
:
BadRequestHttpException
: 400 Bad RequestConflictHttpException
: 409 ConflictForbiddenHttpException
: 403 ForbiddenInternalServerErrorHttpException
: 500 Internal Server ErrorNotFoundHttpException
: 404 Not FoundNotImplementedHttpException
: 501 Not ImplementedServiceUnavailableHttpException
: 503 Service UnavailableUnauthorizedHttpException
: 401 Unauthorized