Prado\Exceptions\TErrorHandler::handleError PHP Method

handleError() public method

This is the event handler responding to the Error event raised in {@link TApplication}. The method mainly uses appropriate template to display the error/exception. It terminates the application immediately after the error is displayed.
public handleError ( $sender, $param )
    public function handleError($sender, $param)
    {
        static $handling = false;
        // We need to restore error and exception handlers,
        // because within error and exception handlers, new errors and exceptions
        // cannot be handled properly by PHP
        restore_error_handler();
        restore_exception_handler();
        // ensure that we do not enter infinite loop of error handling
        if ($handling) {
            $this->handleRecursiveError($param);
        } else {
            $handling = true;
            if (($response = $this->getResponse()) !== null) {
                $response->clear();
            }
            if (!headers_sent()) {
                header('Content-Type: text/html; charset=UTF-8');
            }
            if ($param instanceof THttpException) {
                $this->handleExternalError($param->getStatusCode(), $param);
            } else {
                if ($this->getApplication()->getMode() === TApplicationMode::Debug) {
                    $this->displayException($param);
                } else {
                    $this->handleExternalError(500, $param);
                }
            }
        }
    }