Skip to content

Commit bd1237c

Browse files
author
Marco Bunge
committed
Fix php throwable handling
1 parent b729267 commit bd1237c

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/Application.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,19 @@ protected function initSystem(){
795795

796796
// exception handler
797797
set_exception_handler(function($exception){
798+
/** @var \Exception|\Throwable $exception */
799+
// Convert throwable to exception fpr backwards compatibility
800+
if(!($exception instanceof \Exception)){
801+
$throwable = $exception;
802+
$exception = new \ErrorException(
803+
$throwable->getMessage(),
804+
$throwable->getCode(),
805+
E_ERROR,
806+
$throwable->getFile(),
807+
$throwable->getLine()
808+
);
809+
}
810+
798811
$event = $this->getApplicationEvent();
799812
$this->emit($event->setName(self::EVENT_SYSTEM_EXCEPTION), $exception);
800813
});

0 commit comments

Comments
 (0)