Skip to content

Commit

Permalink
fix: send response if handled by handler
Browse files Browse the repository at this point in the history
  • Loading branch information
ipranjal committed Oct 2, 2024
1 parent b0b9082 commit 2b9cec6
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/functions.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

if(class_exists(\Scrawler\App)){
\Scrawler\App::engine()->registerHandler('exception', function($e){
if(class_exists(\Scrawler\App::class) && function_exists('app')){
app()->registerHandler('exception', function($e){
$whoops = new \Whoops\Run;
$whoops->allowQuit(false);
$whoops->writeToOutput(false);
Expand All @@ -10,7 +10,11 @@
}else{
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
}
return $whoops->handleException($e);
$output = $whoops->handleException($e);
app()->response()->setStatusCode(500);
app()->response()->setContent($output);
app()->response()->send();

});
}else{
$whoops = new \Whoops\Run;
Expand Down

0 comments on commit 2b9cec6

Please sign in to comment.