Overview

Namespaces

  • Charcoal
    • App
      • Action
      • Config
      • Handler
      • Middleware
      • Module
      • Route
      • Script
      • ServiceProvider
      • Template

Classes

  • AbstractHandler
  • Error
  • HandlerConfig
  • NotAllowed
  • NotFound
  • PhpError
  • Shutdown

Interfaces

  • HandlerInterface
  • Overview
  • Namespace
  • Class

Class PhpError

Error Handler for PHP 7+ Throwables

Enhanced version of \Slim\Handlers\PhpError.

It outputs the error message and diagnostic information in either JSON, XML, or HTML based on the Accept header.

Charcoal\App\Handler\AbstractHandler implements Charcoal\Config\ConfigurableInterface, Charcoal\App\Handler\HandlerInterface, Psr\Log\LoggerAwareInterface, Charcoal\View\ViewableInterface uses Charcoal\Config\ConfigurableTrait (not available) Psr\Log\LoggerAwareTrait (not available) Charcoal\Translator\TranslatorAwareTrait (not available) Charcoal\View\ViewableTrait (not available)
Extended by Charcoal\App\Handler\PhpError
Namespace: Charcoal\App\Handler
Located at Charcoal/App/Handler/PhpError.php
Methods summary
public Charcoal\App\Handler\PhpError
# setDependencies( Pimple\Container $container )

Inject dependencies from a Pimple Container.

Inject dependencies from a Pimple Container.

Dependencies

  • array $settings — Slim's settings.

Parameters

$container
A dependencies container instance.

Returns

Charcoal\App\Handler\PhpError
Chainable

Overrides

Charcoal\App\Handler\AbstractHandler::setDependencies()
public Psr\Http\Message\ResponseInterface
# __invoke( Psr\Http\Message\ServerRequestInterface $request, Psr\Http\Message\ResponseInterface $response, Throwable $error )

Invoke Error Handler

Invoke Error Handler

Parameters

$request
The most recent Request object.
$response
The most recent Response object.
$error
The caught Throwable object.

Returns

Psr\Http\Message\ResponseInterface
protected Charcoal\App\Handler\PhpError
# setDisplayErrorDetails( boolean $state )

Set whether to display details of the error or a generic message.

Set whether to display details of the error or a generic message.

Parameters

$state
Whether to display error details.

Returns

Charcoal\App\Handler\PhpError
Chainable
public boolean
# displayErrorDetails( )

Retrieves wether the the details of the error message should be displayed.

Retrieves wether the the details of the error message should be displayed.

Returns

boolean
protected Charcoal\App\Handler\PhpError
# setError( Throwable $error )

Set the caught error.

Set the caught error.

Parameters

$error
The caught Throwable object.

Returns

Charcoal\App\Handler\PhpError
Chainable
public Throwable
# error( )

Retrieves the caught error.

Retrieves the caught error.

Returns

Throwable
protected
# writeToErrorLog( )

Write to the error log if displayErrorDetails is false

Write to the error log if displayErrorDetails is false

protected string
# renderTextError( Throwable $error )

Render error as Text.

Render error as Text.

Parameters

$error
The caught Throwable object.

Returns

string
protected string
# renderJsonOutput( )

Render JSON Error

Render JSON Error

Returns

string
protected string
# renderXmlOutput( )

Render XML Error

Render XML Error

Returns

string
protected string
# renderHtmlError( Throwable $error )

Render error as HTML.

Render error as HTML.

Parameters

$error
The caught Throwable object.

Returns

string
public string
# renderHtmlMessage( )

Render body of HTML error

Render body of HTML error

Returns

string
Methods inherited from Charcoal\App\Handler\AbstractHandler
__construct(), baseUrl(), createConfig(), determineContentType(), init(), messageTitle(), renderHtmlOutput(), renderHtmlTemplate(), setBaseUrl(), setContainer()
Properties summary
protected boolean $displayErrorDetails

Whether to output the error's details.

Whether to output the error's details.

#
protected Throwable $error

The caught throwable.

The caught throwable.

#
Properties inherited from Charcoal\App\Handler\AbstractHandler
$baseUrl, $container, $knownContentTypes
API documentation generated by ApiGen