Skip to content

Commit

Permalink
Merge pull request #135 from Chloe070196/24.10.00_handle_eds_search_e…
Browse files Browse the repository at this point in the history
…rror

24.10.00 handle eds search error
  • Loading branch information
Chloe070196 authored Oct 11, 2024
2 parents da63fe1 + db9aed0 commit ccd5969
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
4 changes: 2 additions & 2 deletions code/web/interface/themes/responsive/EBSCO/searchError.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
</div>
{/if}

{if !empty($searchError) && !empty($searchError.error.msg)}
{if !empty($searchError) && !empty($searchError->getMessage())}
<h2>{translate text="Error description" isPublicFacing=true}</h2>
<div>
{$searchError.error.msg}
{$searchError->getMessage()}
</div>
{/if}
</div>
1 change: 1 addition & 0 deletions code/web/release_notes/24.10.00.MD
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@
- E-commerce: SnapPay: drop unused database field and other small fixes. (*JStaub*)
- Correct cron artifact within new default intellij project. (*MDN*)
- When batch updating enumerations, display the label for the new value rather than the internal value. (*MDN*)
- Fix an issue where EBSCO EDS search errors were echoed to the UI on the search page (visible to any visitor) by adding the error message to the logs instead. (*CZ*)

## This release includes code contributions from
###ByWater Solutions
Expand Down
15 changes: 10 additions & 5 deletions code/web/sys/SearchObject/EbscoEdsSearcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public function getCurlConnection() {
}

public function authenticate() {
global $logger;
if (SearchObject_EbscoEdsSearcher::$authenticationToken == null) {
global $library;
$settings = $this->getSettings();
Expand Down Expand Up @@ -185,13 +186,13 @@ public function authenticate() {
//echo("Authenticated in EDS!");
return true;
} elseif ($createSessionResponse->ErrorDescription) {
echo("create session failed, " . print_r($createSessionResponse));
return false;
$logger->log("create session failed, " . print_r($createSessionResponse, true), Logger::LOG_WARNING);
return new AspenError("Error processing search in EBSCO EDS");
}
}
} else {
echo("Authentication failed!, $return");
return false;
$logger->log("Error processing search in EBSCO EDS: " . print_r($return, true), Logger::LOG_WARNING);
return new AspenError("Error processing search in EBSCO EDS: Authentication failed");
}
} else {
return false;
Expand Down Expand Up @@ -553,9 +554,13 @@ function getSearchesFile() {
}

public function processSearch($returnIndexErrors = false, $recommendations = false, $preventQueryModification = false) {
if (!$this->authenticate()) {
$isAuthenticated = $this->authenticate();
if (empty($isAuthenticated)) {
return null;
}
if (get_class($isAuthenticated) == 'AspenError') {
return $isAuthenticated;
}

$this->startQueryTimer();
$hasSearchTerm = false;
Expand Down

0 comments on commit ccd5969

Please sign in to comment.