fixed admin delete server, when server couldn't be found
when you try to delete a server which has already been deleted in pterodactyl, the delete will trow an error.
This commit is contained in:
parent
5877ddbe81
commit
822d3b9540
1 changed files with 6 additions and 1 deletions
|
@ -71,7 +71,12 @@ class Server extends Model
|
|||
|
||||
static::deleting(function (Server $server) {
|
||||
$response = Pterodactyl::client()->delete("/application/servers/{$server->pterodactyl_id}");
|
||||
if ($response->failed() && !is_null($server->pterodactyl_id)) throw new Exception($response['errors'][0]['code']);
|
||||
if ($response->failed() && !is_null($server->pterodactyl_id)) {
|
||||
//only return error when it's not a 404 error
|
||||
if ($response['errors'][0]['status'] != '404') {
|
||||
throw new Exception($response['errors'][0]['code']);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue