From c6986364ef9a0829953a5e7d232cdebcb0ff0227 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Thu, 8 May 2025 21:28:23 +0000 Subject: [PATCH] Bug 23010: Handle error in C4/Items.pm using try/catch Signed-off-by: Emily Lamancusa Signed-off-by: Lucas Gass (cherry picked from commit 316f8bc4b85e8e361cdbe3e340222f751685635d) Signed-off-by: Paul Derscheid --- C4/Items.pm | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/C4/Items.pm b/C4/Items.pm index 7f9f3fccdc..2c22518dc5 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -1732,7 +1732,17 @@ sub ToggleNewStatus { $item->$field($value); push @{ $report->{$itemnumber} }, $substitution; } - $item->store unless $report_only; + unless ($report_only) { + try { + $item->store; + } catch { + push @{ $report->{$itemnumber} }, { + field => 'ERROR', + error => 1, + value => $_->error, + } + } + } } }