Skip to content

Commit 81bf7b7

Browse files
committed
use throwable to detect dns/cert timeouts which were unhandled exceptions
1 parent 3e344ca commit 81bf7b7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Models/Traits/SupportsCertificateCheck.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
namespace Spatie\UptimeMonitor\Models\Traits;
44

5-
use Exception;
65
use Spatie\SslCertificate\SslCertificate;
76
use Spatie\UptimeMonitor\Events\CertificateCheckFailed;
87
use Spatie\UptimeMonitor\Events\CertificateCheckSucceeded;
98
use Spatie\UptimeMonitor\Events\CertificateExpiresSoon;
109
use Spatie\UptimeMonitor\Models\Enums\CertificateStatus;
1110
use Spatie\UptimeMonitor\Models\Monitor;
11+
use Throwable;
1212

1313
trait SupportsCertificateCheck
1414
{
@@ -18,7 +18,7 @@ public function checkCertificate(): void
1818
$certificate = SslCertificate::createForHostName($this->url->getHost());
1919

2020
$this->setCertificate($certificate);
21-
} catch (Exception $exception) {
21+
} catch (Throwable $exception) {
2222
$this->setCertificateException($exception);
2323
}
2424
}
@@ -36,7 +36,7 @@ public function setCertificate(SslCertificate $certificate): void
3636
$this->fireEventsForUpdatedMonitorWithCertificate($this, $certificate);
3737
}
3838

39-
public function setCertificateException(Exception $exception): void
39+
public function setCertificateException(\Throwable $exception): void
4040
{
4141
$this->certificate_status = CertificateStatus::INVALID;
4242
$this->certificate_expiration_date = null;

0 commit comments

Comments
 (0)