File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change 66
77use Exception ;
88use PhpList \Core \Domain \Identity \Exception \AdminAttributeCreationException ;
9+ use PhpList \Core \Domain \Subscription \Exception \AttributeDefinitionCreationException ;
910use PhpList \Core \Domain \Subscription \Exception \SubscriptionCreationException ;
1011use Symfony \Component \HttpFoundation \JsonResponse ;
1112use Symfony \Component \HttpKernel \Event \ExceptionEvent ;
@@ -42,6 +43,11 @@ public function onKernelException(ExceptionEvent $event): void
4243 'message ' => $ exception ->getMessage (),
4344 ], $ exception ->getStatusCode ());
4445 $ event ->setResponse ($ response );
46+ } elseif ($ exception instanceof AttributeDefinitionCreationException) {
47+ $ response = new JsonResponse ([
48+ 'message ' => $ exception ->getMessage (),
49+ ], $ exception ->getStatusCode ());
50+ $ event ->setResponse ($ response );
4551 } elseif ($ exception instanceof ValidatorException) {
4652 $ response = new JsonResponse ([
4753 'message ' => $ exception ->getMessage (),
Original file line number Diff line number Diff line change @@ -74,6 +74,11 @@ public function __construct(
7474 description: 'Failure ' ,
7575 content: new OA \JsonContent (ref: '#/components/schemas/UnauthorizedResponse ' )
7676 ),
77+ new OA \Response (
78+ response: 409 ,
79+ description: 'Failure ' ,
80+ content: new OA \JsonContent (ref: '#/components/schemas/AlreadyExistsResponse ' )
81+ ),
7782 new OA \Response (
7883 response: 422 ,
7984 description: 'Failure ' ,
You can’t perform that action at this time.
0 commit comments