Add API exception handling and error response

[MAILPOET-4135]
This commit is contained in:
Jan Jakes
2022-02-10 11:00:58 +01:00
committed by Veljko V
parent b2a9053fa8
commit b40f344a51
2 changed files with 32 additions and 2 deletions

View File

@@ -0,0 +1,18 @@
<?php declare(strict_types = 1);
namespace MailPoet\Automation\API;
class ErrorResponse extends Response {
public function __construct(
int $status,
string $message,
string $code
) {
parent::__construct(null, $status);
$this->set_data([
'code' => $code,
'message' => $message,
'data' => ['status' => $status],
]);
}
}