mirror of https://github.com/flightphp/core
parent
d32e36ab4b
commit
dc4e075f3f
@ -0,0 +1,28 @@
|
||||
## Errors and Exceptions
|
||||
|
||||
All errors and exceptions are caught by Flight and passed to the `error` method.
|
||||
The default behavior is to send a generic HTTP `500 Internal Server Error` response with some error information.
|
||||
You can override this behavior for your own needs:
|
||||
|
||||
Flight::map('error', function(){
|
||||
// Handle error
|
||||
});
|
||||
|
||||
By default errors are not logged to the web server. You can enable this by changing the config:
|
||||
|
||||
Flight::set('flight.log_errors', true);
|
||||
|
||||
## Not Found
|
||||
|
||||
When a URL can't be found, Flight calls the `notFound` method. The default behavior is to
|
||||
send an HTTP `404 Not Found` response with a simple message. You can override this behavior for your own needs:
|
||||
|
||||
Flight::map('notFound', function(){
|
||||
// Handle not found
|
||||
});
|
||||
|
||||
# Redirects
|
||||
|
||||
You can redirect the current request by using the `redirect` method and passing in a new URL:
|
||||
|
||||
Flight::redirect('/new/location');
|
Loading…
Reference in new issue