catch and redirect back with error

This commit is contained in:
slong753 2023-03-14 16:07:09 -05:00
parent dfd9fcc5e0
commit 60b70a4074

View file

@ -627,7 +627,11 @@ class AssetsController extends Controller
$csv->setHeaderOffset(0);
$header = $csv->getHeader();
$isCheckinHeaderExplicit = in_array('checkin date', (array_map('strtolower', $header)));
try {
$results = $csv->getRecords();
} catch (\Exception $e) {
return back()->with('error', 'There was an error reading the CSV file: '.$e->getMessage());
}
$item = [];
$status = [];
$status['error'] = [];