Skip to content

Commit

Permalink
13 500 error when importing a url that returns a 404 (#38)
Browse files Browse the repository at this point in the history
* Temporary fix for 500 error when importing recipe
  • Loading branch information
MGHollander authored Sep 3, 2023
1 parent 3b659ad commit 798e099
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/Http/Controllers/Recipe/ImportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ public function index()
public function create(ImportRequest $request)
{
$url = $request->get('url');
$parser = $request->get('parser');
$parser = $request->get('parser', 'structured-data');

// TODO: Use proper validation. This is just a quick fix.
try {
!Http::get($url)->ok();
Http::throw()->get($url);
} catch (\Exception $e) {
return back()->with('warning', 'Helaas, er kon geen verbinding worden gemaakt met de opgegeven URL. Bestaat deze pagina nog wel?');
return back()->with('warning', 'Helaas, de URL die je hebt opgegeven lijkt niet (meer) te bestaan. Probeer een andere URL.');
}

match ($parser) {
Expand Down

0 comments on commit 798e099

Please sign in to comment.