Overview
KB
Technical FAQ
PHP Manual
CSS2 Manual
HTML Manual
JS Guide
JS Reference
PhpDock Manual
Nu-Coder Manual
PhpExpress Manual
PHP Joomla
Development
Learn PHP
 
<Yaf_Request_Abstract::getEnvYaf_Request_Abstract::getFiles>
^Yaf_Request_AbstractLast updated: Mon, 26 Oct 2026

Yaf_Request_Abstract::getException

(Yaf >=1.0.0)

Yaf_Request_Abstract::getException — Retrieve the exception

Description

public function Yaf_Request_Abstract::getException(): ?Exception

Retrieve the exception caught during dispatching.

Parameters

This function has no parameters.

Return Values

The Exception caught during dispatching, or null if none.

Examples

Example #1 Yaf_Request_Abstract::getException() example

<?php
// In the bootstrap, enable exception catching so that any exception
// thrown during dispatching is forwarded to the error action
Yaf_Dispatcher::getInstance()->catchException(true);

class ErrorController extends Yaf_Controller_Abstract
{
    public function errorAction($exception)
    {
        var_dump($this->getRequest()->getException() === $exception);
    }
}
?>

The above example will output something similar to:

bool(true)

See Also


<Yaf_Request_Abstract::getEnvYaf_Request_Abstract::getFiles>
^Yaf_Request_AbstractLast updated: Mon, 26 Oct 2026