Throw 504 where necessary

This commit is contained in:
Dane Everitt 2018-03-06 22:17:01 -06:00
parent d3f797bf2a
commit 4964d294f6
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
3 changed files with 12 additions and 2 deletions

View file

@ -4,6 +4,8 @@ namespace Pterodactyl\Http\Controllers\Base;
use Illuminate\Http\Request;
use Pterodactyl\Models\User;
use Illuminate\Http\Response;
use GuzzleHttp\Exception\ConnectException;
use GuzzleHttp\Exception\RequestException;
use Pterodactyl\Http\Controllers\Controller;
use Symfony\Component\HttpKernel\Exception\HttpException;
@ -81,6 +83,8 @@ class IndexController extends Controller
try {
$response = $this->daemonRepository->setServer($server)->setToken($token)->details();
} catch (ConnectException $exception) {
throw new HttpException(Response::HTTP_GATEWAY_TIMEOUT, $exception->getMessage());
} catch (RequestException $exception) {
throw new HttpException(500, $exception->getMessage());
}