Skip to content

Commit 4964d29

Browse files
committed
Throw 504 where necessary
1 parent d3f797b commit 4964d29

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
88
* Fixes a UI error when attempting to change the default Nest and Egg for an existing server.
99
* Correct permissions check in UI to allow subusers with permission to `view-allocations` the ability to actually see the sidebar link.
1010

11+
### Changed
12+
* Panel now throws proper 504: Gateway Timeout errors on server listing when daemon is offline.
13+
1114
## v0.7.5 (Derelict Dermodactylus)
1215
### Fixed
1316
* Fixes application API keys being created as a client API key.

app/Http/Controllers/Base/IndexController.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
use Illuminate\Http\Request;
66
use Pterodactyl\Models\User;
7+
use Illuminate\Http\Response;
8+
use GuzzleHttp\Exception\ConnectException;
79
use GuzzleHttp\Exception\RequestException;
810
use Pterodactyl\Http\Controllers\Controller;
911
use Symfony\Component\HttpKernel\Exception\HttpException;
@@ -81,6 +83,8 @@ public function status(Request $request, $uuid)
8183

8284
try {
8385
$response = $this->daemonRepository->setServer($server)->setToken($token)->details();
86+
} catch (ConnectException $exception) {
87+
throw new HttpException(Response::HTTP_GATEWAY_TIMEOUT, $exception->getMessage());
8488
} catch (RequestException $exception) {
8589
throw new HttpException(500, $exception->getMessage());
8690
}

public/themes/pterodactyl/js/frontend/serverlist.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,11 @@
8080
}
8181
}
8282
}).fail(function (jqXHR) {
83-
console.error(jqXHR);
84-
element.find('[data-action="status"]').html('<span class="label label-default">Error</span>');
83+
if (jqXHR.status === 504) {
84+
element.find('[data-action="status"]').html('<span class="label label-default">Gateway Timeout</span>');
85+
} else {
86+
element.find('[data-action="status"]').html('<span class="label label-default">Error</span>');
87+
}
8588
});
8689
}).promise().done(function () {
8790
setTimeout(updateServerStatus, 10000);

0 commit comments

Comments
 (0)