auth error translatable exception message

This commit is contained in:
Yuri Kuznetsov
2022-12-27 14:37:34 +02:00
parent 3c4e33f0c5
commit a9e8d5b2b2
4 changed files with 31 additions and 2 deletions
@@ -29,8 +29,25 @@
namespace Espo\Core\Exceptions;
class ServiceUnavailable extends \Exception
class ServiceUnavailable extends \Exception implements HasBody
{
/** @var int */
protected $code = 503;
private ?string $body = null;
/**
* Create with a body (supposed to be sent to the frontend).
*/
public static function createWithBody(string $message, string $body): self
{
$exception = new static($message);
$exception->body = $body;
return $exception;
}
public function getBody(): ?string
{
return $this->body;
}
}