Propagate error details to REST API responses

[MAILPOET-4659]
This commit is contained in:
Jan Jakes
2022-10-03 15:55:02 +02:00
committed by Jan Jakeš
parent 6638707282
commit 14eb8db540
2 changed files with 7 additions and 3 deletions

View File

@ -6,13 +6,17 @@ class ErrorResponse extends Response {
public function __construct(
int $status,
string $message,
string $code
string $code,
array $errors = []
) {
parent::__construct(null, $status);
$this->set_data([
'code' => $code,
'message' => $message,
'data' => ['status' => $status],
'data' => [
'status' => $status,
'errors' => $errors,
],
]);
}
}