From da2c74901314f4aee40dbad260ec4bd09b0f0fde Mon Sep 17 00:00:00 2001 From: GlazerMann Date: Fri, 20 Dec 2024 08:15:27 -0600 Subject: [PATCH] Deal with "ADSABS is down for maintenance" --- apiFunctions.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apiFunctions.php b/apiFunctions.php index e39f2c90d1..378304b868 100644 --- a/apiFunctions.php +++ b/apiFunctions.php @@ -1342,12 +1342,17 @@ function Bibcode_Response_Processing(array $curl_opts, string $adsabs_url): obje } if (!is_object($decoded)) { + if (stripos($body, 'down for maintenance') !== false) { + AdsAbsControl::big_give_up(); // @codeCoverageIgnore + AdsAbsControl::small_give_up(); // @codeCoverageIgnore + throw new Exception("ADSABS is down for maintenance", 5000); // @codeCoverageIgnore + } bot_debug_log("Could not decode ADSABS API response:\n" . $body . "\nURL was: " . $adsabs_url); // @codeCoverageIgnore throw new Exception("Could not decode API response:\n" . $body, 5000); // @codeCoverageIgnore } elseif (isset($decoded->response)) { return $decoded->response; /** NORMAL RETURN IS HIDDEN HERE */ } elseif (isset($decoded->error)) { // @codeCoverageIgnore - throw new Exception("" . $decoded->error, 5000); // @codeCoverageIgnore + throw new Exception((string) $decoded->error, 5000); // @codeCoverageIgnore } else { throw new Exception("Could not decode AdsAbs response", 5000); // @codeCoverageIgnore }