X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FController%2FEntryController.php;h=33b5e2ad03905232dad0df1f0e130275e30853c7;hb=5ecdfcd041767c9e3244a92bb0a6cc3c3f80fea3;hp=69dfd4b108a12e305943a35d908acde9a1a60215;hpb=9f95b14dec88cf083cefa38d5fbd84189e07acac;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 69dfd4b1..33b5e2ad 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -23,10 +23,16 @@ class EntryController extends Controller { try { $entry = $this->get('wallabag_core.content_proxy')->updateEntry($entry, $entry->getUrl()); + $em = $this->getDoctrine()->getManager(); $em->persist($entry); $em->flush(); } catch (\Exception $e) { + $this->get('logger')->error('Error while saving an entry', [ + 'exception' => $e, + 'entry' => $entry, + ]); + return false; } @@ -60,11 +66,12 @@ class EntryController extends Controller return $this->redirect($this->generateUrl('view', ['id' => $existingEntry->getId()])); } - $this->updateEntry($entry); - $this->get('session')->getFlashBag()->add( - 'notice', - 'flashes.entry.notice.entry_saved' - ); + $message = 'flashes.entry.notice.entry_saved'; + if (false === $this->updateEntry($entry)) { + $message = 'flashes.entry.notice.entry_saved_failed'; + } + + $this->get('session')->getFlashBag()->add('notice', $message); return $this->redirect($this->generateUrl('homepage')); }