Simplify logic when a server is in an unsupported state

This commit is contained in:
Dane Everitt 2021-01-30 13:28:31 -08:00
parent be26921fcc
commit e30a765071
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
10 changed files with 76 additions and 294 deletions

View file

@ -6,7 +6,7 @@ use Webmozart\Assert\Assert;
use Pterodactyl\Models\Server;
use Illuminate\Database\ConnectionInterface;
use Pterodactyl\Repositories\Wings\DaemonServerRepository;
use Pterodactyl\Exceptions\Http\Server\ServerTransferringException;
use Symfony\Component\HttpKernel\Exception\ConflictHttpException;
class SuspensionService
{
@ -55,7 +55,7 @@ class SuspensionService
// Check if the server is currently being transferred.
if (!is_null($server->transfer)) {
throw new ServerTransferringException();
throw new ConflictHttpException('Cannot toggle suspension status on a server that is currently being transferred.');
}
$this->connection->transaction(function () use ($action, $server, $isSuspending) {