The Twig runtime error is not very useful
Use the previous exception to provide more information
This commit is contained in:
parent
f334be5116
commit
58ace7ee6c
|
|
@ -8,6 +8,8 @@ use Cms\Classes\Router;
|
|||
use Cms\Classes\Controller;
|
||||
use October\Rain\Exception\ErrorHandler as ErrorHandlerBase;
|
||||
use October\Rain\Exception\ApplicationException;
|
||||
use Twig_Error_Runtime;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* System Error Handler, this class handles application exception events.
|
||||
|
|
@ -17,6 +19,22 @@ use October\Rain\Exception\ApplicationException;
|
|||
*/
|
||||
class ErrorHandler extends ErrorHandlerBase
|
||||
{
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function handleException(Exception $proposedException)
|
||||
{
|
||||
// The Twig runtime error is not very useful
|
||||
if (
|
||||
$proposedException instanceof Twig_Error_Runtime &&
|
||||
($previousException = $proposedException->getPrevious())
|
||||
) {
|
||||
$proposedException = $previousException;
|
||||
}
|
||||
|
||||
return parent::handleException($proposedException);
|
||||
}
|
||||
|
||||
/**
|
||||
* We are about to display an error page to the user,
|
||||
* if it is an ApplicationException, this event should be logged.
|
||||
|
|
|
|||
Loading…
Reference in New Issue