$ob_level
$ob_level : integer
Nesting level of the output buffering mechanism
Exceptions manager
$config : \Config\Exceptions
Config for debug exceptions.
$request : \CodeIgniter\HTTP\IncomingRequest
The incoming request.
$response : \CodeIgniter\HTTP\Response
The outgoing response.
respond(array|string|null $data = null, integer $status = null, string $message = '') : mixed
Provides a single, simple method to return an API response, formatted to match the requested format, with proper content-type and status code.
array|string|null | $data | |
integer | $status | |
string | $message |
fail(string|array $messages, integer|null $status = 400, string|null $code = null, string $customMessage = '') : mixed
Used for generic failures that no custom methods exist for.
string|array | $messages | |
integer|null | $status | HTTP status code |
string|null | $code | Custom, API-specific, error code |
string | $customMessage |
failUnauthorized(string $description = 'Unauthorized', string $code = null, string $message = '') : mixed
Used when the client is either didn't send authorization information, or had bad authorization credentials. User is encouraged to try again with the proper information.
string | $description | |
string | $code | |
string | $message |
failResourceGone(string $description = 'Gone', string $code = null, string $message = '') : mixed
Use when a resource was previously deleted. This is different than Not Found, because here we know the data previously existed, but is now gone, where Not Found means we simply cannot find any information about it.
string | $description | |
string | $code | |
string | $message |
failServerError(string $description = 'Internal Server Error', string|null $code = null, string $message = '') : \CodeIgniter\HTTP\Response
Used when there is a server error.
string | $description | The error message to show the user. |
string|null | $code | A custom, API-specific, error code. |
string | $message | A custom "reason" message to return. |
The value of the Response's send() method.
__construct(\Config\Exceptions $config, \CodeIgniter\HTTP\IncomingRequest $request, \CodeIgniter\HTTP\Response $response)
Constructor.
\Config\Exceptions | $config | |
\CodeIgniter\HTTP\IncomingRequest | $request | |
\CodeIgniter\HTTP\Response | $response |
exceptionHandler(\Throwable $exception)
Catches any uncaught errors and exceptions, including most Fatal errors (Yay PHP7!). Will log the error, display it if display_errors is on, and fire an event that allows custom actions to be taken at this point.
\Throwable | $exception |
errorHandler(integer $severity, string $message, string|null $file = null, integer|null $line = null, null $context = null)
Even in PHP7, some errors make it through to the errorHandler, so convert these to Exceptions and let the exception handler log it and display it.
This seems to be primarily when a user triggers it with trigger_error().
integer | $severity | |
string | $message | |
string|null | $file | |
integer|null | $line | |
null | $context |
determineView(\Throwable $exception, string $template_path) : string
Determines the view to display based on the exception thrown, whether an HTTP or CLI request, etc.
\Throwable | $exception | |
string | $template_path |
The path and filename of the view file to use