Merge branch 'fix-unthrowable-exception'

This commit is contained in:
William Hall
2021-02-08 17:20:43 +00:00
2 changed files with 8 additions and 6 deletions
+5 -5
View File
@@ -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()));
}
}
}
}
+3 -1
View File
@@ -1,5 +1,7 @@
<?php
namespace RobThree\Auth\Providers\Time;
use RobThree\Auth\TwoFactorAuthException;
class TimeException extends TwoFactorAuthException {}
class TimeException extends TwoFactorAuthException {}