catch exception on judging controller

This commit is contained in:
Matt Young 2025-12-13 11:04:56 -06:00
parent 59629e227d
commit 38d7826218
1 changed files with 7 additions and 2 deletions

View File

@ -3,6 +3,7 @@
namespace App\Http\Controllers\Judging; namespace App\Http\Controllers\Judging;
use App\Actions\Tabulation\EnterScore; use App\Actions\Tabulation\EnterScore;
use App\Exceptions\AuditionAdminException;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\Audition; use App\Models\Audition;
use App\Models\Entry; use App\Models\Entry;
@ -30,7 +31,7 @@ class JudgingController extends Controller
$rooms = Auth::user()->judgingAssignments()->with('auditions')->with('prelimAuditions')->get(); $rooms = Auth::user()->judgingAssignments()->with('auditions')->with('prelimAuditions')->get();
$bonusScoresToJudge = Auth::user()->bonusJudgingAssignments()->with('auditions')->get(); $bonusScoresToJudge = Auth::user()->bonusJudgingAssignments()->with('auditions')->get();
//$rooms->load('auditions'); // $rooms->load('auditions');
return view('judging.index', compact('rooms', 'bonusScoresToJudge')); return view('judging.index', compact('rooms', 'bonusScoresToJudge'));
} }
@ -100,7 +101,11 @@ class JudgingController extends Controller
// Enter the score // Enter the score
/** @noinspection PhpUnhandledExceptionInspection */ /** @noinspection PhpUnhandledExceptionInspection */
$enterScore(Auth::user(), $entry, $validatedData['score']); try {
$enterScore(Auth::user(), $entry, $validatedData['score']);
} catch (AuditionAdminException $e) {
return redirect()->back()->with('error', $e->getMessage());
}
// Deal with an advancement vote if needed // Deal with an advancement vote if needed
$this->advancementVote($request, $entry); $this->advancementVote($request, $entry);