LP#1879983: ensure that open-ils.curbside is optional
authorGalen Charlton <gmc@equinoxinitiative.org>
Mon, 15 Jun 2020 20:47:19 +0000 (16:47 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Mon, 15 Jun 2020 20:47:19 +0000 (16:47 -0400)
This fixes a crash in My Account if the patron views their
avaialable holds but open-ils.curbside isn't running.

This isn't bulletproof; an Evergreen site that has enabled
the circ.curbside library setting but doesn't have the
open-ils.curbside service running will see difficulties.

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm

index 75fc78d..2fc2b70 100644 (file)
@@ -5,6 +5,7 @@ use OpenSRF::Utils::Logger qw/$logger/;
 use OpenILS::Utils::CStoreEditor qw/:funcs/;
 use OpenILS::Utils::Fieldmapper;
 use OpenILS::Application::AppUtils;
+use OpenSRF::EX qw/:try/;
 use OpenILS::Event;
 use OpenSRF::Utils::JSON;
 use OpenSRF::Utils::Cache;
@@ -1182,11 +1183,14 @@ sub fetch_user_holds {
         );
     }
 
-    my $curbsides = $U->simplereq(
-        'open-ils.curbside',
-        'open-ils.curbside.fetch_mine.atomic',
-        $e->authtoken
-    );
+    my $curbsides = [];
+    try { # if the service is not running, just let this fail silently
+        $curbsides = $U->simplereq(
+            'open-ils.curbside',
+            'open-ils.curbside.fetch_mine.atomic',
+            $e->authtoken
+        );
+    } catch Error with {};
 
     my @pickup_libs = sort { $U->find_org($U->get_org_tree,$a)->name cmp $U->find_org($U->get_org_tree,$b)->name } keys %pickup_libs;