Skip to content

Commit fe8a4f5

Browse files
committed
wip
1 parent f97b140 commit fe8a4f5

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

packages/core/src/FrameworkKernel.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
namespace Tempest\Core;
66

77
use Dotenv\Dotenv;
8+
use ErrorException;
9+
use RuntimeException;
10+
use Tempest\Console\Exceptions\ConsoleExceptionHandler;
811
use Tempest\Container\Container;
912
use Tempest\Container\GenericContainer;
1013
use Tempest\Core\Kernel\FinishDeferredTasks;
@@ -14,6 +17,7 @@
1417
use Tempest\Core\Kernel\RegisterEmergencyExceptionHandler;
1518
use Tempest\EventBus\EventBus;
1619
use Tempest\Process\GenericProcessExecutor;
20+
use Tempest\Router\Exceptions\HttpExceptionHandler;
1721

1822
final class FrameworkKernel implements Kernel
1923
{
@@ -67,7 +71,7 @@ public function validateRoot(): self
6771
$root = realpath($this->root);
6872

6973
if (! is_dir($root)) {
70-
throw new \RuntimeException('The specified root directory is not valid.');
74+
throw new RuntimeException('The specified root directory is not valid.');
7175
}
7276

7377
$this->root = $root;
@@ -227,11 +231,15 @@ public function registerExceptionHandler(): self
227231
return $this;
228232
}
229233

234+
if (! class_exists(ConsoleExceptionHandler::class, false) || ! class_exists(HttpExceptionHandler::class, false)) {
235+
return $this;
236+
}
237+
230238
$handler = $this->container->get(ExceptionHandler::class);
231239

232240
set_exception_handler($handler->handle(...));
233241
set_error_handler(fn (int $code, string $message, string $filename, int $line) => $handler->handle(
234-
new \ErrorException(
242+
new ErrorException(
235243
message: $message,
236244
code: $code,
237245
filename: $filename,

0 commit comments

Comments
 (0)