Catch packet errors and display a nice error
This commit is contained in:
parent
7356bedfa2
commit
16a1d8a440
@ -43,7 +43,13 @@ class HomeController extends Controller
|
||||
continue;
|
||||
|
||||
foreach ($filegroup as $file) {
|
||||
$pkt = new Packet($file);
|
||||
try {
|
||||
$pkt = new Packet($file);
|
||||
|
||||
} catch (\Exception $e) {
|
||||
return redirect()->back()->withErrors($e->getMessage());
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -26,6 +26,19 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if($errors->count())
|
||||
<div class="row">
|
||||
<span class="pl-5 btn btn-sm btn-danger" role="alert" style="text-align: left;">
|
||||
There were errors with the submission.
|
||||
<ul>
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</span>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<a href="{{ url('/') }}" class="btn btn-danger">Cancel</a>
|
||||
|
Loading…
Reference in New Issue
Block a user