diff --git a/application/Espo/Core/Formula/Functions/RecordServiceGroup/ThrowBadRequestType.php b/application/Espo/Core/Formula/Functions/RecordServiceGroup/ThrowBadRequestType.php index f2fca28eee..72d731015c 100644 --- a/application/Espo/Core/Formula/Functions/RecordServiceGroup/ThrowBadRequestType.php +++ b/application/Espo/Core/Formula/Functions/RecordServiceGroup/ThrowBadRequestType.php @@ -30,6 +30,7 @@ namespace Espo\Core\Formula\Functions\RecordServiceGroup; use Espo\Core\Exceptions\BadRequest; +use Espo\Core\Exceptions\Error\Body; use Espo\Core\Formula\ArgumentList; use Espo\Core\Formula\Exceptions\Error; use Espo\Core\Formula\Exceptions\ExecutionException; @@ -49,13 +50,13 @@ class ThrowBadRequestType extends BaseFunction $this->throwError("Can be called only from API script."); } - $statusText = isset($args[0]) ? $this->evaluate($args[0]) : ''; + $message = isset($args[0]) ? $this->evaluate($args[0]) : ''; $body = isset($args[1]) ? $this->evaluate($args[1]) : null; if ($body !== null) { - throw BadRequest::createWithBody($statusText, Json::encode($body)); + throw BadRequest::createWithBody($message, Json::encode($body)); } - throw new BadRequest($statusText); + throw BadRequest::createWithBody($message, Body::create()->withMessage($message)); } } diff --git a/application/Espo/Core/Formula/Functions/RecordServiceGroup/ThrowConflictType.php b/application/Espo/Core/Formula/Functions/RecordServiceGroup/ThrowConflictType.php index c16f530acc..0af6f430d8 100644 --- a/application/Espo/Core/Formula/Functions/RecordServiceGroup/ThrowConflictType.php +++ b/application/Espo/Core/Formula/Functions/RecordServiceGroup/ThrowConflictType.php @@ -31,6 +31,7 @@ namespace Espo\Core\Formula\Functions\RecordServiceGroup; use Espo\Core\Exceptions\Conflict; use Espo\Core\Exceptions\ConflictSilent; +use Espo\Core\Exceptions\Error\Body; use Espo\Core\Formula\ArgumentList; use Espo\Core\Formula\Exceptions\Error; use Espo\Core\Formula\Exceptions\ExecutionException; @@ -50,13 +51,13 @@ class ThrowConflictType extends BaseFunction $this->throwError("Can be called only from API script."); } - $statusText = isset($args[0]) ? $this->evaluate($args[0]) : ''; + $message = isset($args[0]) ? $this->evaluate($args[0]) : ''; $body = isset($args[1]) ? $this->evaluate($args[1]) : null; if ($body !== null) { - throw ConflictSilent::createWithBody($statusText, Json::encode($body)); + throw ConflictSilent::createWithBody($message, Json::encode($body)); } - throw new ConflictSilent($statusText); + throw ConflictSilent::createWithBody($message, Body::create()->withMessage($message)); } } diff --git a/application/Espo/Core/Formula/Functions/RecordServiceGroup/ThrowForbiddenType.php b/application/Espo/Core/Formula/Functions/RecordServiceGroup/ThrowForbiddenType.php index 934f9b00ba..420c523212 100644 --- a/application/Espo/Core/Formula/Functions/RecordServiceGroup/ThrowForbiddenType.php +++ b/application/Espo/Core/Formula/Functions/RecordServiceGroup/ThrowForbiddenType.php @@ -29,6 +29,7 @@ namespace Espo\Core\Formula\Functions\RecordServiceGroup; +use Espo\Core\Exceptions\Error\Body; use Espo\Core\Exceptions\Forbidden; use Espo\Core\Exceptions\ForbiddenSilent; use Espo\Core\Formula\ArgumentList; @@ -50,13 +51,13 @@ class ThrowForbiddenType extends BaseFunction $this->throwError("Can be called only from API script."); } - $statusText = isset($args[0]) ? $this->evaluate($args[0]) : ''; + $message = isset($args[0]) ? $this->evaluate($args[0]) : ''; $body = isset($args[1]) ? $this->evaluate($args[1]) : null; if ($body !== null) { - throw ForbiddenSilent::createWithBody($statusText, Json::encode($body)); + throw ForbiddenSilent::createWithBody($message, Json::encode($body)); } - throw new ForbiddenSilent($statusText); + throw ForbiddenSilent::createWithBody($message, Body::create()->withMessage($message)); } }