From df74a59b43076637ca71b913322fbe0c05467b8c Mon Sep 17 00:00:00 2001 From: William Hall Date: Fri, 5 Feb 2021 16:30:19 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix=20unthrowable=20exception?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/Providers/Time/HttpTimeProvider.php | 10 +++++----- lib/Providers/Time/TimeException.php | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/Providers/Time/HttpTimeProvider.php b/lib/Providers/Time/HttpTimeProvider.php index 8e7806e..1f98f57 100644 --- a/lib/Providers/Time/HttpTimeProvider.php +++ b/lib/Providers/Time/HttpTimeProvider.php @@ -45,10 +45,10 @@ class HttpTimeProvider implements ITimeProvider if (strcasecmp(substr($h, 0, 5), 'Date:') === 0) return \DateTime::createFromFormat($this->expectedtimeformat, trim(substr($h,5)))->getTimestamp(); } - throw new \TimeException(sprintf('Unable to retrieve time from %s (Invalid or no "Date:" header found)', $this->url)); - } - catch (Exception $ex) { - throw new \TimeException(sprintf('Unable to retrieve time from %s (%s)', $this->url, $ex->getMessage())); + throw new \Exception('Invalid or no "Date:" header found'); + } catch (\Exception $ex) { + throw new TimeException(sprintf('Unable to retrieve time from %s (%s)', $this->url, $ex->getMessage())); } + } -} \ No newline at end of file +} diff --git a/lib/Providers/Time/TimeException.php b/lib/Providers/Time/TimeException.php index 8de544d..c5a06e2 100644 --- a/lib/Providers/Time/TimeException.php +++ b/lib/Providers/Time/TimeException.php @@ -1,5 +1,7 @@