Skip to content

Commit a457e00

Browse files
fix: debug mode
1 parent 0684f44 commit a457e00

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/ApiExceptionHandler.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,13 @@ private function prepareApiExceptionData(Throwable $exception): array
8181
} else {
8282
$responseData['message'] = config('api-responses.unknown_error');
8383
}
84-
$responseData['statusCode'] = ($exception instanceof HttpExceptionInterface) ? $exception->getStatusCode() : 500;
84+
85+
$responseData['statusCode'] = 500;
86+
87+
// If debug mode is enabled, add debug data to response
88+
if (config('api-responses.debug_mode')) {
89+
$responseData['debug'] = $this->extractExceptionData($exception);
90+
}
8591
}
8692

8793
return $responseData;

0 commit comments

Comments
 (0)