Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/1.0-develop/app/Exceptions/Http/Server/ServerStateConflictException.php
10284 views
1
<?php
2
3
namespace Pterodactyl\Exceptions\Http\Server;
4
5
use Pterodactyl\Models\Server;
6
use Symfony\Component\HttpKernel\Exception\ConflictHttpException;
7
8
class ServerStateConflictException extends ConflictHttpException
9
{
10
/**
11
* Exception thrown when the server is in an unsupported state for API access or
12
* certain operations within the codebase.
13
*/
14
public function __construct(Server $server, ?\Throwable $previous = null)
15
{
16
$message = 'This server is currently in an unsupported state, please try again later.';
17
if ($server->isSuspended()) {
18
$message = 'This server is currently suspended and the functionality requested is unavailable.';
19
} elseif ($server->node->isUnderMaintenance()) {
20
$message = 'The node of this server is currently under maintenance and the functionality requested is unavailable.';
21
} elseif (!$server->isInstalled()) {
22
$message = 'This server has not yet completed its installation process, please try again later.';
23
} elseif ($server->status === Server::STATUS_RESTORING_BACKUP) {
24
$message = 'This server is currently restoring from a backup, please try again later.';
25
} elseif (!is_null($server->transfer)) {
26
$message = 'This server is currently being transferred to a new machine, please try again later.';
27
}
28
29
parent::__construct($message, $previous);
30
}
31
}
32
33