Skip to content

Commit fbd1b3f

Browse files
committed
Improved display for server view if not installed
1 parent be47565 commit fbd1b3f

File tree

3 files changed

+216
-201
lines changed

3 files changed

+216
-201
lines changed

app/Http/Controllers/Admin/ServersController.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,10 @@ public function postToggleInstall(Request $request, $id)
341341
$server = new ServerRepository;
342342
$server->toggleInstall($id);
343343
Alert::success('Server status was successfully toggled.')->flash();
344-
} catch(\Exception $e) {
345-
Log::error($e);
344+
} catch (\Pterodactyl\Exceptions\DisplayException $ex) {
345+
Alert::danger($ex->getMessage())->flash();
346+
} catch(\Exception $ex) {
347+
Log::error($ex);
346348
Alert::danger('An unhandled exception occured while attemping to toggle this servers status.')->flash();
347349
} finally {
348350
return redirect()->route('admin.servers.view', [

app/Repositories/ServerRepository.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -696,6 +696,9 @@ public function deleteServer($id, $force)
696696
public function toggleInstall($id)
697697
{
698698
$server = Models\Server::findOrFail($id);
699+
if ($server->installed === 2) {
700+
throw new DisplayException('This server was marked as having a failed install, you cannot override this.');
701+
}
699702
$server->installed = ($server->installed === 1) ? 0 : 1;
700703
return $server->save();
701704
}

0 commit comments

Comments
 (0)