From 0765ecb89776374b692413a41285ed7001e7f07b Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Sun, 8 Apr 2012 18:13:26 -0400 Subject: [PATCH] TPAC: Protect against requests for non-existent records If a record request is received for a record that does not exist (say, if 100 records have been loaded and someone submits a request for /eg/opac/record/399), rather than dying with a server error, return immediately. Eventually we'll want to provide an explicit "record was not found error" in the TPAC record details; for now the TPAC just displays zero bib detail. Signed-off-by: Dan Scott Signed-off-by: Thomas Berezansky --- Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm index 6031eac5dd..a283f41792 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Util.pm @@ -235,6 +235,10 @@ sub get_records_and_facets { success_handler => sub { my($self, $req) = @_; my $data = $req->{response}->[0]->content; + + # Protect against requests for non-existent records + return unless $data->{'unapi.bre'}; + my $xml = XML::LibXML->new->parse_string($data->{'unapi.bre'})->documentElement; # Protect against legacy invalid MARCXML that might not have a 901c -- 2.43.2