1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00

wrap into try catch

This commit is contained in:
Benjamin Beganović 2020-11-24 11:52:01 +01:00
parent 242d48cd1a
commit 549fd92671

View File

@ -53,7 +53,13 @@ class SetupController extends Controller
public function doSetup(StoreSetupRequest $request) public function doSetup(StoreSetupRequest $request)
{ {
try {
$check = SystemHealth::check(false); $check = SystemHealth::check(false);
} catch (\Exception $e) {
info(['message' => $e->getMessage(), 'action' => 'SetupController::doSetup()']);
return response()->json(['message' => $e->getMessage()], 400);
}
if ($check['system_health'] === false) { if ($check['system_health'] === false) {
info($check); info($check);
@ -63,7 +69,7 @@ class SetupController extends Controller
$mail_driver = $request->input('mail_driver'); $mail_driver = $request->input('mail_driver');
if (! $this->failsafeMailCheck($request)) { if (!$this->failsafeMailCheck($request)) {
$mail_driver = 'log'; $mail_driver = 'log';
} }
@ -141,6 +147,7 @@ class SetupController extends Controller
*/ */
public function checkDB(CheckDatabaseRequest $request): Response public function checkDB(CheckDatabaseRequest $request): Response
{ {
try {
$status = SystemHealth::dbCheck($request); $status = SystemHealth::dbCheck($request);
if (is_array($status) && $status['success'] === true) { if (is_array($status) && $status['success'] === true) {
@ -148,6 +155,11 @@ class SetupController extends Controller
} }
return response($status, 400); return response($status, 400);
} catch (\Exception $e) {
info(['message' => $e->getMessage(), 'action' => 'SetupController::checkDB()']);
return response()->json(['message' => $e->getMessage()], 400);
}
} }
/** /**