Don't trigger a 500 error with bad data; closes #2442
This whole chunk of code needs some cleanup but I'll defer that for the new admin area in the future
This commit is contained in:
parent
d1c30607cf
commit
2d56cacbab
1 changed files with 8 additions and 3 deletions
|
@ -333,13 +333,18 @@ class ServersController extends Controller
|
||||||
* @return \Illuminate\Http\RedirectResponse
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
*
|
*
|
||||||
* @throws \Illuminate\Validation\ValidationException
|
* @throws \Illuminate\Validation\ValidationException
|
||||||
* @throws \Pterodactyl\Exceptions\Model\DataValidationException
|
|
||||||
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
|
||||||
*/
|
*/
|
||||||
public function saveStartup(Request $request, Server $server)
|
public function saveStartup(Request $request, Server $server)
|
||||||
{
|
{
|
||||||
$this->startupModificationService->setUserLevel(User::USER_LEVEL_ADMIN);
|
try {
|
||||||
$this->startupModificationService->handle($server, $request->except('_token'));
|
$this->startupModificationService
|
||||||
|
->setUserLevel(User::USER_LEVEL_ADMIN)
|
||||||
|
->handle($server, $request->except('_token'));
|
||||||
|
} catch (DataValidationException $exception) {
|
||||||
|
throw new ValidationException($exception->validator);
|
||||||
|
}
|
||||||
|
|
||||||
$this->alert->success(trans('admin/server.alerts.startup_changed'))->flash();
|
$this->alert->success(trans('admin/server.alerts.startup_changed'))->flash();
|
||||||
|
|
||||||
return redirect()->route('admin.servers.view.startup', $server->id);
|
return redirect()->route('admin.servers.view.startup', $server->id);
|
||||||
|
|
Loading…
Reference in a new issue