I am trying to upload a file. And if it throws an exception I don't want to see the "whoops" page. Instead it will go back the previous page with a message. This is what I tried,
try {
$data = Excel::toArray(new Import, request('file'));
} catch (\Exception $e) {
return back()->withErrors("an exception occured");
}
But it still gives me the whoops page whenever any exception occurs.
How to solve it?