From af34d97928215c10b97c7c86d72da2b9ebde085f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 11 Apr 2023 13:46:51 +0200 Subject: [PATCH] Bug 33482: Propagate errors from EBSCO's ws to the UI When adding or removing eholdings from EBSCO, if an error happens it is lost and not propagated to the UI. We were missing a return in the logic, and always returning 200 Test plan: Do not apply (or revert) bug 33481 Configure EBSCO for ERM and add a package to your holdings With this patch applied you will get a 500 that is propagated to the UI Without this patch nothing happens and the user is not aware that something bad happened Signed-off-by: Pedro Amorim Signed-off-by: Martin Renvoize Signed-off-by: Tomas Cohen Arazi --- Koha/REST/V1/ERM/EHoldings/Packages/EBSCO.pm | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Koha/REST/V1/ERM/EHoldings/Packages/EBSCO.pm b/Koha/REST/V1/ERM/EHoldings/Packages/EBSCO.pm index ccdad76922..8c65c08706 100644 --- a/Koha/REST/V1/ERM/EHoldings/Packages/EBSCO.pm +++ b/Koha/REST/V1/ERM/EHoldings/Packages/EBSCO.pm @@ -116,7 +116,7 @@ sub get { ); } catch { - $c->unhandled_exception($_); + return $c->unhandled_exception($_); }; } @@ -138,6 +138,11 @@ sub edit { isSelected => $is_selected, } ); + + return $c->render( + status => 200, + openapi => { is_selected => $is_selected } # We don't want to refetch the resource to make sure it has been updated + ); } catch { if ( blessed $_ ) { @@ -150,16 +155,11 @@ sub edit { } } - $c->unhandled_exception($_); + return $c->unhandled_exception($_); }; - - return $c->render( - status => 200, - openapi => { is_selected => $is_selected } # We don't want to refetch the resource to make sure it has been updated - ); } catch { - $c->unhandled_exception($_); + return $c->unhandled_exception($_); }; } -- 2.39.5