Skip to content

Commit

Permalink
fix: no exceptions for delete paths
Browse files Browse the repository at this point in the history
Signed-off-by: Anupam Kumar <kyteinsky@gmail.com>
  • Loading branch information
kyteinsky committed May 2, 2024
1 parent b55bae8 commit 0661bc0
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions lib/Service/LangRopeService.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,35 +131,40 @@ private function requestToExApp(
* @param string $userId
* @param string $providerKey
* @return void
* @throws RuntimeException
*/
public function deleteSourcesByProvider(string $userId, string $providerKey): void {
$params = [
'userId' => $userId,
'providerKey' => $providerKey,
];

$this->requestToExApp('/deleteSourcesByProvider', 'POST', $params);
try {
$this->requestToExApp('/deleteSourcesByProvider', 'POST', $params);
} catch (RuntimeException $e) {
$this->logger->error('Could not delete sources by provider', ['exception' => $e]);
}
}

/**
* @param string $providerKey
* @return void
* @throws RuntimeException
*/
public function deleteSourcesByProviderForAllUsers(string $providerKey): void {
$params = [
'providerKey' => $providerKey,
];

$this->requestToExApp('/deleteSourcesByProviderForAllUsers', 'POST', $params);
try {
$this->requestToExApp('/deleteSourcesByProviderForAllUsers', 'POST', $params);
} catch (RuntimeException $e) {
$this->logger->error('Could not delete sources by provider for all users', ['exception' => $e]);
}
}

/**
* @param string $userId
* @param string[] $sourceNames
* @return void
* @throws RuntimeException
*/
public function deleteSources(string $userId, array $sourceNames): void {
if (count($sourceNames) === 0) {
Expand All @@ -171,7 +176,11 @@ public function deleteSources(string $userId, array $sourceNames): void {
'sourceNames' => $sourceNames,
];

$this->requestToExApp('/deleteSources', 'POST', $params);
try {
$this->requestToExApp('/deleteSources', 'POST', $params);
} catch (RuntimeException $e) {
$this->logger->error('Could not delete sources', ['exception' => $e]);
}
}

/**
Expand Down

0 comments on commit 0661bc0

Please sign in to comment.