From 4493589cdc60a7923519d6d07753b390e8b9434e Mon Sep 17 00:00:00 2001 From: Demian Katz Date: Tue, 9 Jan 2024 13:57:54 -0500 Subject: [PATCH 1/2] Throw exception when full MARC record is missing. --- .../VuFind/src/VuFind/RecordDriver/Feature/MarcReaderTrait.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/module/VuFind/src/VuFind/RecordDriver/Feature/MarcReaderTrait.php b/module/VuFind/src/VuFind/RecordDriver/Feature/MarcReaderTrait.php index cc15cf362d3..0d16ce4c39d 100644 --- a/module/VuFind/src/VuFind/RecordDriver/Feature/MarcReaderTrait.php +++ b/module/VuFind/src/VuFind/RecordDriver/Feature/MarcReaderTrait.php @@ -81,6 +81,9 @@ public function getRawMarcData() break; } } + if (!isset($this->fields[$preferredMarcField])) { + throw new \Exception('Missing MARC data in record ' . $this->getUniqueId()); + } return trim($this->fields[$preferredMarcField]); } From c4932c0c5aaf395122beebc84b8c1decda2d68e2 Mon Sep 17 00:00:00 2001 From: Demian Katz Date: Tue, 9 Jan 2024 14:17:01 -0500 Subject: [PATCH 2/2] Update MarcReaderTrait.php --- .../VuFind/src/VuFind/RecordDriver/Feature/MarcReaderTrait.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/VuFind/src/VuFind/RecordDriver/Feature/MarcReaderTrait.php b/module/VuFind/src/VuFind/RecordDriver/Feature/MarcReaderTrait.php index 0d16ce4c39d..bc2f3081af8 100644 --- a/module/VuFind/src/VuFind/RecordDriver/Feature/MarcReaderTrait.php +++ b/module/VuFind/src/VuFind/RecordDriver/Feature/MarcReaderTrait.php @@ -81,7 +81,7 @@ public function getRawMarcData() break; } } - if (!isset($this->fields[$preferredMarcField])) { + if (empty($this->fields[$preferredMarcField])) { throw new \Exception('Missing MARC data in record ' . $this->getUniqueId()); } return trim($this->fields[$preferredMarcField]);