Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public function register()
{
$this->renderable(function (Throwable $e, $request) {
if ($request->wantsJson() || $request->is('*api*')) {
return ApiExceptionHandler::renderAsApiResponse($e);
return ApiExceptionHandler::renderAsApiResponse($e, $request);
}
});
}
Expand All @@ -146,7 +146,7 @@ public function register()
public function render($request, Throwable $exception)
{
if ($request->wantsJson() || $request->is('*api*')) {
return ApiExceptionHandler::renderAsApiResponse($exception);
return ApiExceptionHandler::renderAsApiResponse($exception, $request);
}

return parent::render($request, $exception);
Expand Down
2 changes: 1 addition & 1 deletion src/ExceptionHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public static function renderAsApiResponse(Throwable $e, Request $request = null
$request = $request ?? request();

if ($e instanceof ApiException) {
return $e->render();
return $e->render()->toResponse($request);
}

try {
Expand Down