Skip to content

Commit c68921c

Browse files
committed
Catch CouldNotReadUploadedFileException
1 parent 2748491 commit c68921c

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Subscription/Controller/SubscriberImportController.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Exception;
88
use OpenApi\Attributes as OA;
99
use PhpList\Core\Domain\Identity\Model\PrivilegeFlag;
10+
use PhpList\Core\Domain\Subscription\Exception\CouldNotReadUploadedFileException;
1011
use PhpList\Core\Domain\Subscription\Model\Dto\SubscriberImportOptions;
1112
use PhpList\Core\Domain\Subscription\Service\SubscriberCsvImporter;
1213
use PhpList\Core\Security\Authentication;
@@ -144,6 +145,10 @@ public function importSubscribers(Request $request): JsonResponse
144145
'skipped' => $stats['skipped'],
145146
'errors' => $stats['errors']
146147
]);
148+
} catch (CouldNotReadUploadedFileException $exception) {
149+
return $this->json([
150+
'message' => 'Could not read uploaded file.' . $exception->getMessage()
151+
], Response::HTTP_BAD_REQUEST);
147152
} catch (Exception $e) {
148153
return $this->json([
149154
'message' => $e->getMessage()

0 commit comments

Comments
 (0)