feat: improved exception handling

This commit is contained in:
Björn Fromme
2025-03-27 09:56:00 +01:00
parent 485d37518f
commit 589787f024
7 changed files with 50 additions and 51 deletions
+3 -4
View File
@@ -4,7 +4,6 @@ namespace App\Controller;
use App\BusProNet\ApiClient;
use App\BusProNet\Exception\ApiClientException;
use App\BusProNet\Exception\ResponseParserException;
use App\BusProNet\Model\PersonalData;
use App\Form\PersonalDataType;
use Psr\Log\LoggerInterface;
@@ -38,7 +37,7 @@ class PersonalDataController extends AbstractController
$personalData = $this
->apiClient
->getPersonalData($bpnUser->getEmail(), $bpnUser->getPassword());
} catch (ApiClientException|ResponseParserException $e) {
} catch (ApiClientException $e) {
$this->addFlash('error', 'Deine persönlichen Daten konnten nicht abgerufen werden');
$personalData = new PersonalData();
}
@@ -82,7 +81,7 @@ class PersonalDataController extends AbstractController
$personalData = $this
->apiClient
->getPersonalData($bpnUser->getEmail(), $bpnUser->getPassword());
} catch (ApiClientException|ResponseParserException $e) {
} catch (ApiClientException $e) {
$this->addFlash('error', 'Deine persönlichen Daten konnten nicht abgerufen werden');
$personalData = new PersonalData();
}
@@ -95,7 +94,7 @@ class PersonalDataController extends AbstractController
$this->logger->info('Updated newsletter registration', [
'email' => $bpnUser->getEmail(),
]);
} catch (ApiClientException|ResponseParserException $e) {
} catch (ApiClientException $e) {
$this->addFlash('error', $e->getMessage());
}