Skip to content

Commit 8cd1a6c

Browse files
committed
Report exceptions thrown during the route dispatching.
Reference issue dingo#971.
1 parent 021ed72 commit 8cd1a6c

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

src/Http/Middleware/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function handle($request, Closure $next)
100100
return $this->sendRequestThroughRouter($request);
101101
}
102102
} catch (Exception $exception) {
103-
$this->app['Dingo\Api\Contract\Debug\ExceptionHandler']->report($exception);
103+
$this->exception->report($exception);
104104

105105
return $this->exception->handle($exception);
106106
}

src/Routing/Router.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,8 @@ public function dispatch(Request $request)
581581
throw $exception;
582582
}
583583

584+
$this->exception->report($exception);
585+
584586
$response = $this->exception->handle($exception);
585587
}
586588

tests/Routing/RouterTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,7 @@ public function testExceptionsAreHandledByExceptionHandler()
252252
});
253253
});
254254

255+
$this->exception->shouldReceive('report')->once()->with($exception);
255256
$this->exception->shouldReceive('handle')->once()->with($exception)->andReturn(new Http\Response('exception'));
256257

257258
$request = $this->createRequest('foo', 'GET', ['accept' => 'application/vnd.api.v1+json']);

0 commit comments

Comments
 (0)