3
3
namespace Rareloop \Lumberjack \Exceptions ;
4
4
5
5
use Exception ;
6
+ use Laminas \Diactoros \Response \HtmlResponse ;
6
7
use Psr \Http \Message \ResponseInterface ;
7
8
use Psr \Http \Message \ServerRequestInterface ;
8
9
use Rareloop \Lumberjack \Application ;
9
10
use Rareloop \Lumberjack \Facades \Config ;
10
- use Symfony \Component \Debug \ExceptionHandler as SymfonyExceptionHandler ;
11
- use Symfony \Component \Debug \Exception \FlattenException ;
12
- use Zend \Diactoros \Response \HtmlResponse ;
11
+ use Spatie \Ignition \Ignition ;
13
12
14
13
class Handler implements HandlerInterface
15
14
{
@@ -36,11 +35,17 @@ public function report(Exception $e)
36
35
37
36
public function render (ServerRequestInterface $ request , Exception $ e ) : ResponseInterface
38
37
{
39
- $ e = FlattenException:: create ( $ e ) ;
38
+ $ isDebug = Config:: get ( ' app.debug ' , false ) === true ;
40
39
41
- $ handler = new SymfonyExceptionHandler (Config:: get ( ' app.debug ' , false ) );
40
+ $ ignition = Ignition:: make ()-> shouldDisplayException ( $ isDebug )-> register ( );
42
41
43
- return new HtmlResponse ($ handler ->getHtml ($ e ), $ e ->getStatusCode (), $ e ->getHeaders ());
42
+ ob_start ();
43
+
44
+ $ ignition ->handleException ($ e );
45
+
46
+ $ html = ob_get_clean ();
47
+
48
+ return new HtmlResponse ($ html );
44
49
}
45
50
46
51
protected function shouldNotReport (Exception $ e )
0 commit comments