Fix allocation selection

This commit is contained in:
Dane Everitt 2016-01-22 21:43:56 -05:00
parent ae843a72c6
commit be48fbd418
2 changed files with 19 additions and 15 deletions

View file

@ -211,24 +211,24 @@ class AjaxController extends Controller
}
try {
$repo = new Repositories\ServerRepository;
$repo->changeBuild($server->id, [
'default' => $request->input('connection'),
]);
return response('The default connection for this server has been updated. Please be aware that you will need to restart your server for this change to go into effect.');
} catch (\Exception $e) {
if ($e instanceof \Pterodactyl\Exceptions\DisplayException || $e instanceof \Pterodactyl\Exceptions\DisplayValidationException) {
return response()->json([
'error' => $e->getMessage(),
], 503);
} else {
Log::error($e);
return response()->json([
'error' => 'An unhandled exception occured while attemping to modify the default connection for this server.'
], 503);
}
} catch (\Pterodactyl\Exceptions\DisplayValidationException $ex) {
return response()->json([
'error' => json_decode($ex->getMessage(), true),
], 503);
} catch (\Pterodactyl\Exceptions\DisplayException $ex) {
return response()->json([
'error' => $ex->getMessage(),
], 503);
} catch (\Exception $ex) {
Log::error($ex);
return response()->json([
'error' => 'An unhandled exception occured while attemping to modify the default connection for this server.'
], 503);
}
}