PHP Class AppserverIo\Appserver\ServletEngine\Utils\ErrorUtil

Show file Open project: appserver-io/appserver Class Usage Examples

Protected Properties

Property Type Description
$instance ErrorUtil The singleton instance.

Public Methods

Method Description
fromArray ( array $error ) : AppserverIo\Appserver\ServletEngine\Utils\ErrorInterface Create's a new error instance with the values from the passed array.
fromException ( Exception $e ) : AppserverIo\Appserver\ServletEngine\Utils\ErrorInterface Create's a new error instance from the passed exception.
handleErrors ( RequestHandler $requestHandler, AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse ) : void This method finally handles all PHP and user errors as well as the exceptions that have been thrown through the servlet processing.
mapErrorCode ( AppserverIo\Appserver\ServletEngine\Utils\ErrorInterface $error ) : string Return's the a human readable error representation for the passed error instance.
mapLogLevel ( AppserverIo\Appserver\ServletEngine\Utils\ErrorInterface $error ) : string Return's the log level for the passed error instance.
prepareMessage ( AppserverIo\Appserver\ServletEngine\Utils\ErrorInterface $error ) : string Prepare's the error message for logging/rendering purposes.
singleton ( ) : ErrorUtil Create's and return's the singleton instance.

Method Details

fromArray() public method

Create's a new error instance with the values from the passed array.
public fromArray ( array $error ) : AppserverIo\Appserver\ServletEngine\Utils\ErrorInterface
$error array The array containing the error information
return AppserverIo\Appserver\ServletEngine\Utils\ErrorInterface The error instance

fromException() public method

Create's a new error instance from the passed exception.
public fromException ( Exception $e ) : AppserverIo\Appserver\ServletEngine\Utils\ErrorInterface
$e Exception The exception to create the error instance from
return AppserverIo\Appserver\ServletEngine\Utils\ErrorInterface The error instance

handleErrors() public method

This method finally handles all PHP and user errors as well as the exceptions that have been thrown through the servlet processing.
public handleErrors ( RequestHandler $requestHandler, AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface $servletRequest, AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface $servletResponse ) : void
$requestHandler AppserverIo\Appserver\ServletEngine\RequestHandler The request handler instance
$servletRequest AppserverIo\Psr\Servlet\Http\HttpServletRequestInterface The actual request instance
$servletResponse AppserverIo\Psr\Servlet\Http\HttpServletResponseInterface The actual request instance
return void

mapErrorCode() public method

Return's the a human readable error representation for the passed error instance.
public mapErrorCode ( AppserverIo\Appserver\ServletEngine\Utils\ErrorInterface $error ) : string
$error AppserverIo\Appserver\ServletEngine\Utils\ErrorInterface The error instance
return string The human readable error representation

mapLogLevel() public method

Return's the log level for the passed error instance.
public mapLogLevel ( AppserverIo\Appserver\ServletEngine\Utils\ErrorInterface $error ) : string
$error AppserverIo\Appserver\ServletEngine\Utils\ErrorInterface The error instance to map the log level for
return string

prepareMessage() public method

Prepare's the error message for logging/rendering purposes.
public prepareMessage ( AppserverIo\Appserver\ServletEngine\Utils\ErrorInterface $error ) : string
$error AppserverIo\Appserver\ServletEngine\Utils\ErrorInterface The error instance to create the message from
return string The error message

singleton() public static method

Create's and return's the singleton instance.
public static singleton ( ) : ErrorUtil
return ErrorUtil The singleton instance

Property Details

$instance protected static property

The singleton instance.
protected static ErrorUtil,AppserverIo\Appserver\ServletEngine\Utils $instance
return ErrorUtil