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