From 9b2d64d856e158a5f1aa5b8633011d8ea4f65039 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20M=C3=BCller?= Date: Wed, 9 Oct 2024 21:36:47 +0200 Subject: [PATCH] Add specific exception if pad is not publicly available (#68) --- src/Exception/EtherpadServiceNotPublicException.php | 10 ++++++++++ src/Service/ScannerService.php | 8 +++----- 2 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 src/Exception/EtherpadServiceNotPublicException.php diff --git a/src/Exception/EtherpadServiceNotPublicException.php b/src/Exception/EtherpadServiceNotPublicException.php new file mode 100644 index 0000000..5d49aab --- /dev/null +++ b/src/Exception/EtherpadServiceNotPublicException.php @@ -0,0 +1,10 @@ +getAdmin('user', 'changeme1', $callback); } - /** - * @throws EtherpadServiceNotFoundException - */ private function scanPad(ScannerServiceCallbackInterface $callback): void { $callback->onScanPadStart(); @@ -529,7 +527,7 @@ private function handleClientVarsResponse( $data = $data[1]; $accessStatus = $data['accessStatus'] ?? null; if ($accessStatus === 'deny') { - $callback->onScanPadException(new EtherpadServiceNotFoundException('Pads are not publicly accessible')); + $callback->onScanPadException(new EtherpadServiceNotPublicException('Pads are not publicly accessible')); return; } @@ -582,7 +580,7 @@ private function doSocketWebsocket( if ($result !== null && is_array($result->data)) { $accessStatus = $result->data['accessStatus'] ?? null; if ($accessStatus === 'deny') { - $callback->onScanPadException(new EtherpadServiceNotFoundException('Pads are not publicly accessible')); + $callback->onScanPadException(new EtherpadServiceNotPublicException('Pads are not publicly accessible')); return; } $data = $result->data;