-
Notifications
You must be signed in to change notification settings - Fork 9
Home
HTTP_status_exceptions is a simple plugin to enable the use of exceptions to generate responses with different HTTP status codes. This can be used to cleanup your controller in handling edge-cases.
For instance, you could raise a HTTPStatus::Forbidden
exception if the user is not authorized to perform restricted action, or you could raise a HTTPStatus::PaymentRequired
if the user should renew its membership to your website. By default, this plugin will send an empty response with the desired HHTP status code. It is possible to respond with a customized error page as well. In the case of HTTPStatus::PaymentRequired
, a response with a credit card payment form can be used, so that the user easily can renew his membership.
This plugin is written by Willem van Bergen and is released under the MIT license. It consists of about 40 lines of meta-programming.