Catch the correct Exception when creating a list on import

This is not part of this issue but found it when looking at the Exception types.

[MAILPOET-4259]
This commit is contained in:
Brezo Cordero
2022-05-20 21:41:08 -05:00
committed by Veljko V
parent 2e5e8e808f
commit 53b9f79e65

View File

@ -2,11 +2,11 @@
namespace MailPoet\API\JSON\v1;
use InvalidArgumentException;
use MailPoet\API\JSON\Endpoint as APIEndpoint;
use MailPoet\API\JSON\Error as APIError;
use MailPoet\API\JSON\ResponseBuilders\SegmentsResponseBuilder;
use MailPoet\Config\AccessControl;
use MailPoet\ConflictException;
use MailPoet\Cron\CronWorkerScheduler;
use MailPoet\Cron\Workers\WooCommerceSync;
use MailPoet\CustomFields\CustomFieldsRepository;
@ -109,7 +109,7 @@ class ImportExport extends APIEndpoint {
return $this->badRequest([
APIError::BAD_REQUEST => __('Please specify a name.', 'mailpoet'),
]);
} catch (InvalidArgumentException $exception) {
} catch (ConflictException $exception) {
return $this->badRequest([
APIError::BAD_REQUEST => __('Another record already exists. Please specify a different "name".', 'mailpoet'),
]);