Skip to content

Commit 3bf7b07

Browse files
committed
refactor: let php-fpm start exceptions bubble up
1 parent 3b73384 commit 3bf7b07

2 files changed

Lines changed: 1 addition & 40 deletions

File tree

src/WebsiteRuntime.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,7 @@ public static function createFromApplication(ApplicationInterface $application):
8282
*/
8383
public function start(): void
8484
{
85-
try {
86-
$this->phpFpmProcess->start();
87-
} catch (\Throwable $exception) {
88-
$this->logger->exception($exception);
89-
$this->client->sendInitializationError($exception);
90-
91-
$this->terminate(1);
92-
}
85+
$this->phpFpmProcess->start();
9386
}
9487

9588
/**

tests/Unit/WebsiteRuntimeTest.php

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -189,38 +189,6 @@ public function testProcessNextEventWithPhpFpmTimeoutException(): void
189189
$runtime->processNextEvent();
190190
}
191191

192-
public function testStartWithException(): void
193-
{
194-
$client = $this->getLambdaRuntimeApiClientMock();
195-
$exception = new \Exception('test exception');
196-
$handler = $this->getLambdaEventHandlerInterfaceMock();
197-
$logger = $this->getLoggerMock();
198-
$process = $this->getPhpFpmProcessMock();
199-
200-
$process->expects($this->once())
201-
->method('start')
202-
->willThrowException($exception);
203-
204-
$logger->expects($this->once())
205-
->method('exception')
206-
->with($this->identicalTo($exception));
207-
208-
$client->expects($this->once())
209-
->method('sendInitializationError')
210-
->with($this->identicalTo($exception));
211-
212-
$runtime = $this->getMockBuilder(WebsiteRuntime::class)
213-
->setConstructorArgs([$client, $handler, $logger, $process])
214-
->setMethods(['terminate'])
215-
->getMock();
216-
217-
$runtime->expects($this->once())
218-
->method('terminate')
219-
->with(1);
220-
221-
$runtime->start();
222-
}
223-
224192
public function testStartWithNoException(): void
225193
{
226194
$client = $this->getLambdaRuntimeApiClientMock();

0 commit comments

Comments
 (0)