Remove catch block and change quotes

Remove catch block to log unexpected exceptions and change quotes for consistency on error message.

[MAILPOET-4259]
This commit is contained in:
Brezo Cordero
2022-05-24 10:25:14 -05:00
committed by Veljko V
parent 53b9f79e65
commit 3d1365595b
4 changed files with 6 additions and 8 deletions

View File

@@ -152,6 +152,7 @@ class Subscribers extends APIEndpoint {
/**
* @param array $data
* @return ErrorResponse|SuccessResponse
* @throws \Exception
*/
public function save(array $data = []) {
try {
@@ -162,11 +163,8 @@ class Subscribers extends APIEndpoint {
return $this->badRequest([
APIError::BAD_REQUEST => $conflictException->getMessage(),
]);
} catch (\Exception $unknownException) {
return $this->badRequest([
APIError::UNKNOWN => __('Saving subscriber failed.', 'mailpoet'),
]);
}
};
return $this->successResponse(
$this->subscribersResponseBuilder->build($subscriber)
);