Skip to content
Snippets Groups Projects
Commit 1f051174 authored by Ere Maijala's avatar Ere Maijala Committed by Demian Katz
Browse files

Avoid throwing exceptions inside getMyFines. (#1149)

- Routinely throwing errors in a non-error situation can be inconvenient for debugging.
parent fc6101b7
Branches
Tags
No related merge requests found
...@@ -1359,19 +1359,20 @@ class MyResearchController extends AbstractBase ...@@ -1359,19 +1359,20 @@ class MyResearchController extends AbstractBase
foreach ($result as $row) { foreach ($result as $row) {
// Attempt to look up and inject title: // Attempt to look up and inject title:
try { try {
if (!isset($row['id']) || empty($row['id'])) { if (strlen($row['id'] ?? '') > 0) {
throw new \Exception(); $source = $row['source'] ?? DEFAULT_SEARCH_BACKEND;
} $row['driver'] = $this->serviceLocator
$source = $row['source'] ?? DEFAULT_SEARCH_BACKEND; ->get('VuFind\Record\Loader')->load($row['id'], $source);
$row['driver'] = $this->serviceLocator if (empty($row['title'])) {
->get('VuFind\Record\Loader')->load($row['id'], $source); $row['title'] = $row['driver']->getShortTitle();
if (empty($row['title'])) { }
$row['title'] = $row['driver']->getShortTitle();
} }
} catch (\Exception $e) { } catch (\Exception $e) {
if (!isset($row['title'])) { // Ignore record loading exceptions...
$row['title'] = null; }
} // In case we skipped or failed record loading, make sure title is set.
if (!isset($row['title'])) {
$row['title'] = null;
} }
$fines[] = $row; $fines[] = $row;
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment