Skip to content

Commit

Permalink
Revert "[10.x] Fix inconsistentcy between report and render metho…
Browse files Browse the repository at this point in the history
…ds (#47201)" (#47326)

This reverts commit c95df92.
  • Loading branch information
taylorotwell authored Jun 2, 2023
1 parent c60191f commit 838bb1b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/Illuminate/Foundation/Exceptions/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -373,8 +373,6 @@ protected function context()
*/
public function render($request, Throwable $e)
{
$e = $this->prepareException($this->mapException($e));

if (method_exists($e, 'render') && $response = $e->render($request)) {
return Router::toResponse($request, $response);
}
Expand All @@ -383,6 +381,8 @@ public function render($request, Throwable $e)
return $e->toResponse($request);
}

$e = $this->prepareException($this->mapException($e));

if ($response = $this->renderViaCallbacks($request, $e)) {
return $response;
}
Expand Down
11 changes: 0 additions & 11 deletions tests/Foundation/FoundationExceptionsHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,17 +195,6 @@ public function testReturnsCustomResponseWhenExceptionImplementsResponsable()
$this->assertSame('{"response":"My responsable exception response"}', $response);
}

public function testReturnsCustomResponseFromMappedException()
{
$this->handler->map(function (RuntimeException $e) {
return new ResponsableException();
});

$response = $this->handler->render($this->request, new RuntimeException)->getContent();

$this->assertSame('{"response":"My responsable exception response"}', $response);
}

public function testReturnsJsonWithoutStackTraceWhenAjaxRequestAndDebugFalseAndExceptionMessageIsMasked()
{
$this->config->shouldReceive('get')->with('app.debug', null)->once()->andReturn(false);
Expand Down

0 comments on commit 838bb1b

Please sign in to comment.