Skip to content

Commit 095eda2

Browse files
committed
refactor(core)!: update exception processors to no longer return a throwable (#1342)
1 parent a5b4212 commit 095eda2

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

packages/core/src/ExceptionProcessor.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ interface ExceptionProcessor
99
/**
1010
* Processes the given exception.
1111
*/
12-
public function process(Throwable $throwable): Throwable;
12+
public function process(Throwable $throwable): void;
1313
}

packages/core/src/ExceptionReporter.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function __construct(
1919
) {}
2020

2121
/**
22-
* Reports the given exception to the registered exceptionm processors.
22+
* Reports the given exception to the registered exception processors.
2323
*/
2424
public function report(Throwable $throwable): void
2525
{
@@ -29,9 +29,10 @@ public function report(Throwable $throwable): void
2929
return;
3030
}
3131

32+
/** @var class-string<\Tempest\Core\ExceptionProcessor> $processor */
3233
foreach ($this->appConfig->exceptionProcessors as $processor) {
3334
$handler = $this->container->get($processor);
34-
$throwable = $handler->process($throwable);
35+
$handler->process($throwable);
3536
}
3637
}
3738
}

packages/core/src/LogExceptionProcessor.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111
final class LogExceptionProcessor implements ExceptionProcessor
1212
{
13-
public function process(Throwable $throwable): Throwable
13+
public function process(Throwable $throwable): void
1414
{
1515
$items = [
1616
'exception' => $throwable->getMessage(),
@@ -20,7 +20,5 @@ public function process(Throwable $throwable): Throwable
2020
];
2121

2222
Debug::resolve()->log($items, writeToOut: false);
23-
24-
return $throwable;
2523
}
2624
}

tests/Integration/Http/Fixtures/NullExceptionProcessor.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ final class NullExceptionProcessor implements ExceptionProcessor
1111
{
1212
public static array $exceptions = [];
1313

14-
public function process(Throwable $throwable): Throwable
14+
public function process(Throwable $throwable): void
1515
{
1616
static::$exceptions[] = $throwable;
17-
18-
return $throwable;
1917
}
2018
}

0 commit comments

Comments
 (0)