aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-05-30 14:32:41 +0200
committerThomas Citharel <tcit@tcit.fr>2016-06-23 09:15:50 +0200
commit6334f2cac16158a0ea4a8e540ace17550085942b (patch)
tree6772765ca415af66ac1d6871a3475492ebfeb4d0
parentf06f840c9d5e08b81d56e0588dee8249bd2f19af (diff)
downloadwallabag-6334f2cac16158a0ea4a8e540ace17550085942b.tar.gz
wallabag-6334f2cac16158a0ea4a8e540ace17550085942b.tar.zst
wallabag-6334f2cac16158a0ea4a8e540ace17550085942b.zip
Display a message when saving an entry failed
When saving an entry fail because of database error we previously just returned `false`. Now we got an error in the log and the displayed notice to the user is updated too.
-rw-r--r--src/Wallabag/CoreBundle/Controller/EntryController.php17
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.da.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.de.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.en.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.es.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml45
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.it.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml1
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml1
12 files changed, 45 insertions, 27 deletions
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
23 { 23 {
24 try { 24 try {
25 $entry = $this->get('wallabag_core.content_proxy')->updateEntry($entry, $entry->getUrl()); 25 $entry = $this->get('wallabag_core.content_proxy')->updateEntry($entry, $entry->getUrl());
26
26 $em = $this->getDoctrine()->getManager(); 27 $em = $this->getDoctrine()->getManager();
27 $em->persist($entry); 28 $em->persist($entry);
28 $em->flush(); 29 $em->flush();
29 } catch (\Exception $e) { 30 } catch (\Exception $e) {
31 $this->get('logger')->error('Error while saving an entry', [
32 'exception' => $e,
33 'entry' => $entry,
34 ]);
35
30 return false; 36 return false;
31 } 37 }
32 38
@@ -60,11 +66,12 @@ class EntryController extends Controller
60 return $this->redirect($this->generateUrl('view', ['id' => $existingEntry->getId()])); 66 return $this->redirect($this->generateUrl('view', ['id' => $existingEntry->getId()]));
61 } 67 }
62 68
63 $this->updateEntry($entry); 69 $message = 'flashes.entry.notice.entry_saved';
64 $this->get('session')->getFlashBag()->add( 70 if (false === $this->updateEntry($entry)) {
65 'notice', 71 $message = 'flashes.entry.notice.entry_saved_failed';
66 'flashes.entry.notice.entry_saved' 72 }
67 ); 73
74 $this->get('session')->getFlashBag()->add('notice', $message);
68 75
69 return $this->redirect($this->generateUrl('homepage')); 76 return $this->redirect($this->generateUrl('homepage'));
70 } 77 }
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
index 1e58352d..213d5790 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
@@ -397,6 +397,7 @@ flashes:
397 notice: 397 notice:
398 # entry_already_saved: 'Entry already saved on %date%' 398 # entry_already_saved: 'Entry already saved on %date%'
399 # entry_saved: 'Entry saved' 399 # entry_saved: 'Entry saved'
400 # entry_saved_failed: 'Failed to save entry'
400 # entry_updated: 'Entry updated' 401 # entry_updated: 'Entry updated'
401 # entry_reloaded: 'Entry reloaded' 402 # entry_reloaded: 'Entry reloaded'
402 # entry_reload_failed: 'Failed to reload entry' 403 # entry_reload_failed: 'Failed to reload entry'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
index 512b01bc..89cbbbf8 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
@@ -397,6 +397,7 @@ flashes:
397 notice: 397 notice:
398 entry_already_saved: 'Eintrag bereits am %date% gespeichert' 398 entry_already_saved: 'Eintrag bereits am %date% gespeichert'
399 entry_saved: 'Eintag gespeichert' 399 entry_saved: 'Eintag gespeichert'
400 # entry_saved_failed: 'Failed to save entry'
400 entry_updated: 'Eintrag aktualisiert' 401 entry_updated: 'Eintrag aktualisiert'
401 entry_reloaded: 'Eintrag neugeladen' 402 entry_reloaded: 'Eintrag neugeladen'
402 entry_reload_failed: 'Neuladen des Eintrags fehlgeschlagen' 403 entry_reload_failed: 'Neuladen des Eintrags fehlgeschlagen'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
index ae03f809..b65e4522 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
@@ -397,6 +397,7 @@ flashes:
397 notice: 397 notice:
398 entry_already_saved: 'Entry already saved on %date%' 398 entry_already_saved: 'Entry already saved on %date%'
399 entry_saved: 'Entry saved' 399 entry_saved: 'Entry saved'
400 entry_saved_failed: 'Failed to save entry'
400 entry_updated: 'Entry updated' 401 entry_updated: 'Entry updated'
401 entry_reloaded: 'Entry reloaded' 402 entry_reloaded: 'Entry reloaded'
402 entry_reload_failed: 'Failed to reload entry' 403 entry_reload_failed: 'Failed to reload entry'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
index 0ae2e243..8351bcf4 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
@@ -397,6 +397,7 @@ flashes:
397 notice: 397 notice:
398 entry_already_saved: 'Entrada ya guardada por %fecha%' 398 entry_already_saved: 'Entrada ya guardada por %fecha%'
399 entry_saved: 'Entrada guardada' 399 entry_saved: 'Entrada guardada'
400 # entry_saved_failed: 'Failed to save entry'
400 entry_updated: 'Entrada actualizada' 401 entry_updated: 'Entrada actualizada'
401 entry_reloaded: 'Entrada recargada' 402 entry_reloaded: 'Entrada recargada'
402 entry_reload_failed: 'Entrada recargada reprobada' 403 entry_reload_failed: 'Entrada recargada reprobada'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
index b0601543..db6e5960 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
@@ -96,8 +96,8 @@ config:
96 rule_label: 'قانون' 96 rule_label: 'قانون'
97 tags_label: 'برچسب‌ها' 97 tags_label: 'برچسب‌ها'
98 faq: 98 faq:
99 title: 'پرسش‌های متداول' 99 title: 'پرسش‌های متداول'
100 tagging_rules_definition_title: 'برچسب‌گذاری خودکار یعنی چه؟' 100 tagging_rules_definition_title: 'برچسب‌گذاری خودکار یعنی چه؟'
101 # tagging_rules_definition_description: 'They are rules used by Wallabag to automatically tag new entries.<br />Each time a new entry is added, all the tagging rules will be used to add the tags you configured, thus saving you the trouble to manually classify your entries.' 101 # tagging_rules_definition_description: 'They are rules used by Wallabag to automatically tag new entries.<br />Each time a new entry is added, all the tagging rules will be used to add the tags you configured, thus saving you the trouble to manually classify your entries.'
102 # how_to_use_them_title: 'How do I use them?' 102 # how_to_use_them_title: 'How do I use them?'
103 # how_to_use_them_description: 'Let assume you want to tag new entries as « <i>short reading</i> » when the reading time is inferior to 3 minutes.<br />In that case, you should put « readingTime &lt;= 3 » in the <i>Rule</i> field and « <i>short reading</i> » in the <i>Tags</i> field.<br />Several tags can added simultaneously by separating them by a comma: « <i>short reading, must read</i> »<br />Complex rules can be written by using predefined operators: if « <i>readingTime &gt;= 5 AND domainName = "github.com"</i> » then tag as « <i>long reading, github </i> »' 103 # how_to_use_them_description: 'Let assume you want to tag new entries as « <i>short reading</i> » when the reading time is inferior to 3 minutes.<br />In that case, you should put « readingTime &lt;= 3 » in the <i>Rule</i> field and « <i>short reading</i> » in the <i>Tags</i> field.<br />Several tags can added simultaneously by separating them by a comma: « <i>short reading, must read</i> »<br />Complex rules can be written by using predefined operators: if « <i>readingTime &gt;= 5 AND domainName = "github.com"</i> » then tag as « <i>long reading, github </i> »'
@@ -384,30 +384,31 @@ developer:
384flashes: 384flashes:
385 config: 385 config:
386 notice: 386 notice:
387 config_saved: 'پیکربندی ذخیره شد. برخی از تنظیمات پس از این که قطع شدید اعمال می‌شود.' 387 config_saved: 'پیکربندی ذخیره شد. برخی از تنظیمات پس از این که قطع شدید اعمال می‌شود.'
388 password_updated: 'رمز به‌روز شد' 388 password_updated: 'رمز به‌روز شد'
389 password_not_updated_demo: "در حالت نمایشی نمی‌توانید رمز کاربر را عوض کنید." 389 password_not_updated_demo: "در حالت نمایشی نمی‌توانید رمز کاربر را عوض کنید."
390 user_updated: 'اطلاعات به‌روز شد' 390 user_updated: 'اطلاعات به‌روز شد'
391 rss_updated: 'اطلاعات آر-اس-اس به‌روز شد' 391 rss_updated: 'اطلاعات آر-اس-اس به‌روز شد'
392 tagging_rules_updated: 'برچسب‌گذاری خودکار به‌روز شد' 392 tagging_rules_updated: 'برچسب‌گذاری خودکار به‌روز شد'
393 tagging_rules_deleted: 'قانون برچسب‌گذاری پاک شد' 393 tagging_rules_deleted: 'قانون برچسب‌گذاری پاک شد'
394 user_added: 'کابر "%username%" افزوده شد' 394 user_added: 'کابر "%username%" افزوده شد'
395 rss_token_updated: 'کد آر-اس-اس به‌روز شد' 395 rss_token_updated: 'کد آر-اس-اس به‌روز شد'
396 entry: 396 entry:
397 notice: 397 notice:
398 entry_already_saved: 'این مقاله در تاریخ %date% ذخیره شده بود' 398 entry_already_saved: 'این مقاله در تاریخ %date% ذخیره شده بود'
399 entry_saved: 'مقاله ذخیره شد' 399 entry_saved: 'مقاله ذخیره شد'
400 entry_updated: 'مقاله به‌روز شد' 400 # entry_saved_failed: 'Failed to save entry'
401 entry_reloaded: 'مقاله به‌روز شد' 401 entry_updated: 'مقاله به‌روز شد'
402 entry_reload_failed: 'به‌روزرسانی مقاله شکست خورد' 402 entry_reloaded: 'مقاله به‌روز شد'
403 entry_archived: 'مقاله بایگانی شد' 403 entry_reload_failed: 'به‌روزرسانی مقاله شکست خورد'
404 entry_unarchived: 'مقاله از بایگانی درآمد' 404 entry_archived: 'مقاله بایگانی شد'
405 entry_starred: 'مقاله برگزیده شد' 405 entry_unarchived: 'مقاله از بایگانی درآمد'
406 entry_unstarred: 'مقاله نابرگزیده شد' 406 entry_starred: 'مقاله برگزیده شد'
407 entry_deleted: 'مقاله پاک شد' 407 entry_unstarred: 'مقاله نابرگزیده شد'
408 entry_deleted: 'مقاله پاک شد'
408 tag: 409 tag:
409 notice: 410 notice:
410 tag_added: 'برچسب افزوده شد' 411 tag_added: 'برچسب افزوده شد'
411 import: 412 import:
412 notice: 413 notice:
413 failed: 'درون‌ریزی شکست خورد. لطفاً دوباره تلاش کنید.' 414 failed: 'درون‌ریزی شکست خورد. لطفاً دوباره تلاش کنید.'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
index 954ab0c3..9fc8ca2a 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
@@ -397,6 +397,7 @@ flashes:
397 notice: 397 notice:
398 entry_already_saved: 'Article déjà sauvergardé le %date%' 398 entry_already_saved: 'Article déjà sauvergardé le %date%'
399 entry_saved: 'Article enregistré' 399 entry_saved: 'Article enregistré'
400 entry_saved_failed: "L'enregistrement a échoué"
400 entry_updated: 'Article mis à jour' 401 entry_updated: 'Article mis à jour'
401 entry_reloaded: 'Article rechargé' 402 entry_reloaded: 'Article rechargé'
402 entry_reload_failed: "Le rechargement de l'article a échoué" 403 entry_reload_failed: "Le rechargement de l'article a échoué"
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
index 4f3ac090..00ed9c98 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
@@ -396,6 +396,7 @@ flashes:
396 notice: 396 notice:
397 entry_already_saved: 'Contenuto già salvato in data %date%' 397 entry_already_saved: 'Contenuto già salvato in data %date%'
398 entry_saved: 'Contenuto salvato' 398 entry_saved: 'Contenuto salvato'
399 # entry_saved_failed: 'Failed to save entry'
399 entry_updated: 'Contenuto aggiornato' 400 entry_updated: 'Contenuto aggiornato'
400 entry_reloaded: 'Contenuto ricaricato' 401 entry_reloaded: 'Contenuto ricaricato'
401 entry_reload_failed: 'Errore nel ricaricamento del contenuto' 402 entry_reload_failed: 'Errore nel ricaricamento del contenuto'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
index 24b8c6e2..c81c852b 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
@@ -397,6 +397,7 @@ flashes:
397 notice: 397 notice:
398 entry_already_saved: 'Article ja salvargardat lo %date%' 398 entry_already_saved: 'Article ja salvargardat lo %date%'
399 entry_saved: 'Article enregistrat' 399 entry_saved: 'Article enregistrat'
400 # entry_saved_failed: 'Failed to save entry'
400 entry_updated: 'Article mes a jorn' 401 entry_updated: 'Article mes a jorn'
401 entry_reloaded: 'Article recargat' 402 entry_reloaded: 'Article recargat'
402 entry_reload_failed: "Fracàs de l'actualizacion de l'article" 403 entry_reload_failed: "Fracàs de l'actualizacion de l'article"
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
index fa23f0b8..3707a857 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
@@ -397,6 +397,7 @@ flashes:
397 notice: 397 notice:
398 entry_already_saved: 'Wpis już został dodany %date%' 398 entry_already_saved: 'Wpis już został dodany %date%'
399 entry_saved: 'Wpis zapisany' 399 entry_saved: 'Wpis zapisany'
400 # entry_saved_failed: 'Failed to save entry'
400 entry_updated: 'Wpis zaktualizowany' 401 entry_updated: 'Wpis zaktualizowany'
401 entry_reloaded: 'Wpis ponownie załadowany' 402 entry_reloaded: 'Wpis ponownie załadowany'
402 entry_reload_failed: 'Błąd ponownego załadowania' 403 entry_reload_failed: 'Błąd ponownego załadowania'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
index 648ba370..27be1edc 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
@@ -397,6 +397,7 @@ flashes:
397 notice: 397 notice:
398 # entry_already_saved: 'Entry already saved on %date%' 398 # entry_already_saved: 'Entry already saved on %date%'
399 # entry_saved: 'Entry saved' 399 # entry_saved: 'Entry saved'
400 # entry_saved_failed: 'Failed to save entry'
400 # entry_updated: 'Entry updated' 401 # entry_updated: 'Entry updated'
401 # entry_reloaded: 'Entry reloaded' 402 # entry_reloaded: 'Entry reloaded'
402 # entry_reload_failed: 'Failed to reload entry' 403 # entry_reload_failed: 'Failed to reload entry'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
index 0fc8d328..85ee7316 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
@@ -397,6 +397,7 @@ flashes:
397 notice: 397 notice:
398 entry_already_saved: 'Entry already saved on %date%' 398 entry_already_saved: 'Entry already saved on %date%'
399 entry_saved: 'Makale kaydedildi' 399 entry_saved: 'Makale kaydedildi'
400 # entry_saved_failed: 'Failed to save entry'
400 # entry_updated: 'Entry updated' 401 # entry_updated: 'Entry updated'
401 entry_reloaded: 'Makale içeriği yenilendi' 402 entry_reloaded: 'Makale içeriği yenilendi'
402 # entry_reload_failed: 'Failed to reload entry' 403 # entry_reload_failed: 'Failed to reload entry'