summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/BackgroundJob/CheckHostedSignalingServer.php21
-rw-r--r--lib/Controller/HostedSignalingServerController.php26
-rw-r--r--lib/Notification/Notifier.php47
-rw-r--r--lib/Service/HostedSignalingServerService.php84
-rw-r--r--tests/stubs/GuzzleHttp_Exception_ServerException.php4
5 files changed, 112 insertions, 70 deletions
diff --git a/lib/BackgroundJob/CheckHostedSignalingServer.php b/lib/BackgroundJob/CheckHostedSignalingServer.php
index 834c2ab1c..07d05263e 100644
--- a/lib/BackgroundJob/CheckHostedSignalingServer.php
+++ b/lib/BackgroundJob/CheckHostedSignalingServer.php
@@ -28,6 +28,7 @@ namespace OCA\Talk\BackgroundJob;
use OCA\Talk\DataObjects\AccountId;
use OCA\Talk\Exceptions\HostedSignalingServerAPIException;
use OCA\Talk\Service\HostedSignalingServerService;
+use OCP\AppFramework\Http;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\BackgroundJob\IJob;
use OCP\BackgroundJob\TimedJob;
@@ -67,9 +68,17 @@ class CheckHostedSignalingServer extends TimedJob {
$accountId = new AccountId($accountId);
try {
$accountInfo = $this->hostedSignalingServerService->fetchAccountInfo($accountId);
- } catch (HostedSignalingServerAPIException $e) { // API or connection issues
- // do nothing and just try again later
- return;
+ } catch (HostedSignalingServerAPIException $e) {
+ if ($e->getCode() === Http::STATUS_NOT_FOUND) {
+ // Account was deleted, so remove the information locally
+ $accountInfo = ['status' => 'deleted'];
+ } elseif ($e->getCode() === Http::STATUS_UNAUTHORIZED) {
+ // Account is expired and deletion is pending unless it's reactivated.
+ $accountInfo = ['status' => 'expired'];
+ } else {
+ // API or connection issues - do nothing and just try again later
+ return;
+ }
}
$oldStatus = $oldAccountInfo['status'] ?? '';
@@ -80,15 +89,13 @@ class CheckHostedSignalingServer extends TimedJob {
// the status has changed
if ($oldStatus !== $newStatus) {
- if ($oldStatus === 'active') {
+ if ($newStatus === 'deleted') {
// remove signaling servers if account is not active anymore
$this->config->deleteAppValue('spreed', 'signaling_mode');
$this->config->deleteAppValue('spreed', 'signaling_servers');
$notificationSubject = 'removed';
- }
-
- if ($newStatus === 'active') {
+ } elseif ($newStatus === 'active') {
// add signaling servers if account got active
$this->config->deleteAppValue('spreed', 'signaling_mode');
$this->config->setAppValue('spreed', 'signaling_servers', json_encode([
diff --git a/lib/Controller/HostedSignalingServerController.php b/lib/Controller/HostedSignalingServerController.php
index e0a6767b3..0184d43ab 100644
--- a/lib/Controller/HostedSignalingServerController.php
+++ b/lib/Controller/HostedSignalingServerController.php
@@ -133,19 +133,25 @@ class HostedSignalingServerController extends OCSController {
try {
$this->hostedSignalingServerService->deleteAccount(new AccountId($accountId));
+ } catch (HostedSignalingServerAPIException $e) {
+ if ($e->getCode() === Http::STATUS_NOT_FOUND) {
+ // Account was deleted, so remove the information locally
+ } elseif ($e->getCode() === Http::STATUS_UNAUTHORIZED) {
+ // Account is expired and deletion is pending unless it's reactivated.
+ } else {
+ // API or connection issues - do nothing and just try again later
+ return new DataResponse(['message' => $e->getMessage()], Http::STATUS_INTERNAL_SERVER_ERROR);
+ }
+ }
- $this->config->deleteAppValue('spreed', 'hosted-signaling-server-account');
- $this->config->deleteAppValue('spreed', 'hosted-signaling-server-account-id');
-
- // remove signaling servers if account is not active anymore
- $this->config->deleteAppValue('spreed', 'signaling_mode');
- $this->config->deleteAppValue('spreed', 'signaling_servers');
+ $this->config->deleteAppValue('spreed', 'hosted-signaling-server-account');
+ $this->config->deleteAppValue('spreed', 'hosted-signaling-server-account-id');
- $this->logger->info('Deleted hosted signaling server account with ID ' . $accountId);
- } catch (HostedSignalingServerAPIException $e) { // API or connection issues
- return new DataResponse(['message' => $e->getMessage()], Http::STATUS_INTERNAL_SERVER_ERROR);
- }
+ // remove signaling servers if account is not active anymore
+ $this->config->deleteAppValue('spreed', 'signaling_mode');
+ $this->config->deleteAppValue('spreed', 'signaling_servers');
+ $this->logger->info('Deleted hosted signaling server account with ID ' . $accountId);
return new DataResponse([], Http::STATUS_NO_CONTENT);
}
diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php
index 22e51ebc3..6121eb84f 100644
--- a/lib/Notification/Notifier.php
+++ b/lib/Notification/Notifier.php
@@ -1133,33 +1133,60 @@ class Notifier implements INotifier {
->setLink($notification->getLink(), IAction::TYPE_WEB)
->setPrimary(true);
+ $parsedParameters = [];
+ $icon = '';
switch ($notification->getSubject()) {
case 'added':
- $subject = $l->t('The hosted signaling server is now configured and will be used.');
+ $subject = $l->t('Hosted signaling server added');
+ $message = $l->t('The hosted signaling server is now configured and will be used.');
+ $icon = $this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/video.svg'));
break;
case 'removed':
- $subject = $l->t('The hosted signaling server was removed and will not be used anymore.');
+ $subject = $l->t('Hosted signaling server removed');
+ $message = $l->t('The hosted signaling server was removed and will not be used anymore.');
+ $icon = $this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/video-off.svg'));
break;
case 'changed-status':
- $subject = $l->t('The hosted signaling server account has changed the status from "{oldstatus}" to "{newstatus}".');
+ $subject = $l->t('Hosted signaling server changed');
+ $message = $l->t('The hosted signaling server account has changed the status from "{oldstatus}" to "{newstatus}".');
+ $icon = $this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/video-switch.svg'));
$parameters = $notification->getSubjectParameters();
- $subject = str_replace(
- ['{oldstatus}', '{newstatus}'],
- [$parameters['oldstatus'], $parameters['newstatus']],
- $subject
- );
+ $parsedParameters = [
+ 'oldstatus' => $this->createHPBParameter($parameters['oldstatus'], $l),
+ 'newstatus' => $this->createHPBParameter($parameters['newstatus'], $l),
+ ];
break;
default:
throw new \InvalidArgumentException('Unknown subject');
}
return $notification
- ->setParsedSubject($subject)
- ->setIcon($notification->getIcon())
+ ->setRichSubject($subject)
+ ->setRichMessage($message, $parsedParameters)
+ ->setIcon($icon)
->addParsedAction($action);
}
+ protected function hostedHPBStatusToLabel(string $status, IL10N $l): string {
+ return match ($status) {
+ 'pending' => $l->t('pending'),
+ 'active' => $l->t('active'),
+ 'expired' => $l->t('expired'),
+ 'blocked' => $l->t('blocked'),
+ 'error' => $l->t('error'),
+ default => $status,
+ };
+ }
+
+ protected function createHPBParameter(string $status, IL10N $l): array {
+ return [
+ 'type' => 'highlight',
+ 'id' => $status,
+ 'name' => $this->hostedHPBStatusToLabel($status, $l),
+ ];
+ }
+
protected function parseCertificateExpiration(INotification $notification, IL10N $l): INotification {
$subjectParameters = $notification->getSubjectParameters();
diff --git a/lib/Service/HostedSignalingServerService.php b/lib/Service/HostedSignalingServerService.php
index bfb724080..79bd38112 100644
--- a/lib/Service/HostedSignalingServerService.php
+++ b/lib/Service/HostedSignalingServerService.php
@@ -26,6 +26,7 @@ declare(strict_types=1);
namespace OCA\Talk\Service;
use GuzzleHttp\Exception\ClientException;
+use GuzzleHttp\Exception\ServerException;
use OCA\Talk\DataObjects\AccountId;
use OCA\Talk\DataObjects\RegisterAccountData;
use OCA\Talk\Exceptions\HostedSignalingServerAPIException;
@@ -37,6 +38,9 @@ use OCP\IL10N;
use OCP\Security\ISecureRandom;
use Psr\Log\LoggerInterface;
+/**
+ * API documentation at https://gitlab.com/strukturag/spreed-hpbservice/-/blob/master/doc/API.md
+ */
class HostedSignalingServerService {
/** @var mixed */
private $apiServerUrl;
@@ -86,7 +90,7 @@ class HostedSignalingServerService {
if ($response === null) {
$this->logger->error('Failed to request hosted signaling server trial', ['exception' => $e]);
$message = $this->l10n->t('Failed to request trial because the trial server is unreachable. Please try again later.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, Http::STATUS_INTERNAL_SERVER_ERROR);
}
$status = $response->getStatusCode();
@@ -96,7 +100,7 @@ class HostedSignalingServerService {
$this->logger->error('Requesting hosted signaling server trial failed: unauthorized - HTTP status: ' . $status . ' Response body: ' . $body);
$message = $this->l10n->t('There is a problem with the authentication of this instance. Maybe it is not reachable from the outside to verify it\'s URL.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, $status);
case Http::STATUS_BAD_REQUEST:
$body = $response->getBody()->getContents();
if ($body) {
@@ -105,7 +109,7 @@ class HostedSignalingServerService {
$this->logger->error('Requesting hosted signaling server trial failed: cannot parse JSON response - JSON error: '. json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body);
$message = $this->l10n->t('Something unexpected happened.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, $status);
}
if ($parsedBody['reason']) {
$message = '';
@@ -155,46 +159,46 @@ class HostedSignalingServerService {
// user error
if ($message !== '') {
$this->logger->warning('Requesting hosted signaling server trial failed: bad request - reason: ' . $parsedBody['reason'] . ' ' . $log);
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, $status);
}
$this->logger->error('Requesting hosted signaling server trial failed: bad request - reason: ' . $parsedBody['reason'] . ' ' . $log);
$message = $this->l10n->t('There is a problem with the request of the trial. Please check your logs for further information.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, $status);
}
}
$message = $this->l10n->t('Something unexpected happened.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, $status);
case Http::STATUS_TOO_MANY_REQUESTS:
$body = $response->getBody()->getContents();
$this->logger->error('Requesting hosted signaling server trial failed: too many requests - HTTP status: ' . $status . ' Response body: ' . $body);
$message = $this->l10n->t('Too many requests are send from your servers address. Please try again later.');
- throw new HostedSignalingServerInputException($message);
+ throw new HostedSignalingServerInputException($message, $status);
case Http::STATUS_CONFLICT:
$body = $response->getBody()->getContents();
$this->logger->error('Requesting hosted signaling server trial failed: already registered - HTTP status: ' . $status . ' Response body: ' . $body);
$message = $this->l10n->t('There is already a trial registered for this Nextcloud instance.');
- throw new HostedSignalingServerInputException($message);
+ throw new HostedSignalingServerInputException($message, $status);
case Http::STATUS_INTERNAL_SERVER_ERROR:
$body = $response->getBody()->getContents();
$this->logger->error('Requesting hosted signaling server trial failed: internal server error - HTTP status: ' . $status . ' Response body: ' . $body);
$message = $this->l10n->t('Something unexpected happened. Please try again later.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, $status);
default:
$body = $response->getBody()->getContents();
$this->logger->error('Requesting hosted signaling server trial failed: something else happened - HTTP status: ' . $status . ' Response body: ' . $body);
$message = $this->l10n->t('Failed to request trial because the trial server behaved wrongly. Please try again later.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, $status);
}
} catch (\Exception $e) {
$this->logger->error('Failed to request hosted signaling server trial', ['exception' => $e]);
$message = $this->l10n->t('Failed to request trial because the trial server is unreachable. Please try again later.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, ($e instanceof ServerException ? $e->getResponse()?->getStatusCode() : null) ?? Http::STATUS_INTERNAL_SERVER_ERROR);
}
$status = $response->getStatusCode();
@@ -204,7 +208,7 @@ class HostedSignalingServerService {
$this->logger->error('Requesting hosted signaling server trial failed: something else happened - HTTP status: ' . $status . ' Response body: ' . $body);
$message = $this->l10n->t('Something unexpected happened.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, $status);
}
$body = $response->getBody();
@@ -214,14 +218,14 @@ class HostedSignalingServerService {
$this->logger->error('Requesting hosted signaling server trial failed: cannot parse JSON response - JSON error: '. json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body);
$message = $this->l10n->t('Something unexpected happened.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, Http::STATUS_INTERNAL_SERVER_ERROR);
}
if (!isset($data['account_id'])) {
$this->logger->error('Requesting hosted signaling server trial failed: no account ID transfered - HTTP status: ' . $status . ' Response body: ' . $body);
$message = $this->l10n->t('Something unexpected happened.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, Http::STATUS_INTERNAL_SERVER_ERROR);
}
$accountId = (string)$data['account_id'];
@@ -258,7 +262,7 @@ class HostedSignalingServerService {
if ($response === null) {
$this->logger->error('Trial requested but failed to get account information', ['exception' => $e]);
$message = $this->l10n->t('Trial requested but failed to get account information. Please check back later.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, Http::STATUS_INTERNAL_SERVER_ERROR);
}
$status = $response->getStatusCode();
@@ -269,7 +273,7 @@ class HostedSignalingServerService {
$this->logger->error('Getting the account information failed: unauthorized - HTTP status: ' . $status . ' Response body: ' . $body);
$message = $this->l10n->t('There is a problem with the authentication of this request. Maybe it is not reachable from the outside to verify it\'s URL.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, $status);
case Http::STATUS_BAD_REQUEST:
$body = $response->getBody()->getContents();
if ($body) {
@@ -278,7 +282,7 @@ class HostedSignalingServerService {
$this->logger->error('Getting the account information failed: cannot parse JSON response - JSON error: '. json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body);
$message = $this->l10n->t('Something unexpected happened.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, $status);
}
if ($parsedBody['reason']) {
switch ($parsedBody['reason']) {
@@ -290,46 +294,46 @@ class HostedSignalingServerService {
$this->logger->error('Getting the account information failed: something else happened - HTTP status: ' . $status . ' Response body: ' . $body);
$message = $this->l10n->t('Failed to fetch account information because the trial server behaved wrongly. Please check back later.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, $status);
}
$this->logger->error('Getting the account information failed: bad request - reason: ' . $parsedBody['reason'] . ' ' . $log);
$message = $this->l10n->t('There is a problem with fetching the account information. Please check your logs for further information.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, $status);
}
}
$message = $this->l10n->t('Something unexpected happened.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, $status);
case Http::STATUS_TOO_MANY_REQUESTS:
$body = $response->getBody()->getContents();
$this->logger->error('Getting the account information failed: too many requests - HTTP status: ' . $status . ' Response body: ' . $body);
$message = $this->l10n->t('Too many requests are send from your servers address. Please try again later.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, $status);
case Http::STATUS_NOT_FOUND:
$body = $response->getBody()->getContents();
$this->logger->error('Getting the account information failed: account not found - HTTP status: ' . $status . ' Response body: ' . $body);
$message = $this->l10n->t('There is no such account registered.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, $status);
case Http::STATUS_INTERNAL_SERVER_ERROR:
$body = $response->getBody()->getContents();
$this->logger->error('Getting the account information failed: internal server error - HTTP status: ' . $status . ' Response body: ' . $body);
$message = $this->l10n->t('Something unexpected happened. Please try again later.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, $status);
default:
$body = $response->getBody()->getContents();
$this->logger->error('Getting the account information failed: something else happened - HTTP status: ' . $status . ' Response body: ' . $body);
$message = $this->l10n->t('Failed to fetch account information because the trial server behaved wrongly. Please check back later.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, $status);
}
} catch (\Exception $e) {
$this->logger->error('Failed to request hosted signaling server trial', ['exception' => $e]);
$message = $this->l10n->t('Failed to fetch account information because the trial server is unreachable. Please check back later.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, ($e instanceof ServerException ? $e->getResponse()?->getStatusCode() : null) ?? Http::STATUS_INTERNAL_SERVER_ERROR);
}
$status = $response->getStatusCode();
@@ -340,7 +344,7 @@ class HostedSignalingServerService {
$message = $this->l10n->t('Something unexpected happened.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, $status);
}
$body = $response->getBody();
@@ -350,7 +354,7 @@ class HostedSignalingServerService {
$this->logger->error('Getting the account information failed: cannot parse JSON response - JSON error: '. json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body);
$message = $this->l10n->t('Something unexpected happened.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, Http::STATUS_INTERNAL_SERVER_ERROR);
}
if (!isset($data['status'])
@@ -380,7 +384,7 @@ class HostedSignalingServerService {
$this->logger->error('Getting the account information failed: response is missing mandatory field - data: ' . json_encode($data));
$message = $this->l10n->t('Something unexpected happened.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, Http::STATUS_INTERNAL_SERVER_ERROR);
}
return $data;
@@ -414,7 +418,7 @@ class HostedSignalingServerService {
if ($response === null) {
$this->logger->error('Deleting the hosted signaling server account failed', ['exception' => $e]);
$message = $this->l10n->t('Deleting the hosted signaling server account failed. Please check back later.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, Http::STATUS_INTERNAL_SERVER_ERROR);
}
$status = $response->getStatusCode();
@@ -425,7 +429,7 @@ class HostedSignalingServerService {
$this->logger->error('Deleting the hosted signaling server account failed: unauthorized - HTTP status: ' . $status . ' Response body: ' . $body);
$message = $this->l10n->t('There is a problem with the authentication of this request. Maybe it is not reachable from the outside to verify it\'s URL.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, $status);
case Http::STATUS_BAD_REQUEST:
$body = $response->getBody()->getContents();
if ($body) {
@@ -434,7 +438,7 @@ class HostedSignalingServerService {
$this->logger->error('Deleting the hosted signaling server account failed: cannot parse JSON response - JSON error: '. json_last_error() . ' ' . json_last_error_msg() . ' HTTP status: ' . $status . ' Response body: ' . $body);
$message = $this->l10n->t('Something unexpected happened.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, $status);
}
if ($parsedBody['reason']) {
switch ($parsedBody['reason']) {
@@ -446,46 +450,46 @@ class HostedSignalingServerService {
$this->logger->error('Deleting the hosted signaling server account failed: something else happened - HTTP status: ' . $status . ' Response body: ' . $body);
$message = $this->l10n->t('Failed to delete the account because the trial server behaved wrongly. Please check back later.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, $status);
}
$this->logger->error('Deleting the hosted signaling server account failed: bad request - reason: ' . $parsedBody['reason'] . ' ' . $log);
$message = $this->l10n->t('There is a problem with deleting the account. Please check your logs for further information.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, $status);
}
}
$message = $this->l10n->t('Something unexpected happened.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, $status);
case Http::STATUS_TOO_MANY_REQUESTS:
$body = $response->getBody()->getContents();
$this->logger->error('Deleting the hosted signaling server account failed: too many requests - HTTP status: ' . $status . ' Response body: ' . $body);
$message = $this->l10n->t('Too many requests are sent from your servers address. Please try again later.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, $status);
case Http::STATUS_NOT_FOUND:
$body = $response->getBody()->getContents();
$this->logger->error('Deleting the hosted signaling server account failed: account not found - HTTP status: ' . $status . ' Response body: ' . $body);
$message = $this->l10n->t('There is no such account registered.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, $status);
case Http::STATUS_INTERNAL_SERVER_ERROR:
$body = $response->getBody()->getContents();
$this->logger->error('Deleting the hosted signaling server account failed: internal server error - HTTP status: ' . $status . ' Response body: ' . $body);
$message = $this->l10n->t('Something unexpected happened. Please try again later.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, $status);
default:
$body = $response->getBody()->getContents();
$this->logger->error('Deleting the hosted signaling server account failed: something else happened - HTTP status: ' . $status . ' Response body: ' . $body);
$message = $this->l10n->t('Failed to delete the account because the trial server behaved wrongly. Please check back later.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, $status);
}
} catch (\Exception $e) {
$this->logger->error('Deleting the hosted signaling server account failed', ['exception' => $e]);
$message = $this->l10n->t('Failed to delete the account because the trial server is unreachable. Please check back later.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, ($e instanceof ServerException ? $e->getResponse()?->getStatusCode() : null) ?? Http::STATUS_INTERNAL_SERVER_ERROR);
}
$status = $response->getStatusCode();
@@ -496,7 +500,7 @@ class HostedSignalingServerService {
$message = $this->l10n->t('Something unexpected happened.');
- throw new HostedSignalingServerAPIException($message);
+ throw new HostedSignalingServerAPIException($message, $status);
}
}
}
diff --git a/tests/stubs/GuzzleHttp_Exception_ServerException.php b/tests/stubs/GuzzleHttp_Exception_ServerException.php
index cd9e72548..5ce499c2d 100644
--- a/tests/stubs/GuzzleHttp_Exception_ServerException.php
+++ b/