diff --git a/application/Espo/Core/Api/ActionProcessor.php b/application/Espo/Core/Api/ActionProcessor.php index 60f733de6e..3a7570f6bd 100644 --- a/application/Espo/Core/Api/ActionProcessor.php +++ b/application/Espo/Core/Api/ActionProcessor.php @@ -30,6 +30,7 @@ namespace Espo\Core\Api; use Espo\Core\Exceptions\NotFound; +use Espo\Core\Exceptions\NotFoundSilent; use Espo\Core\InjectableFactory; use Espo\Core\Utils\ClassFinder; use Espo\Core\Utils\Json; @@ -80,7 +81,7 @@ class ActionProcessor $actionMethodName; if (!method_exists($controller, $primaryActionMethodName)) { - throw new NotFound( + throw new NotFoundSilent( "Action {$requestMethod} '{$actionName}' does not exist in controller '{$controllerName}'."); } diff --git a/application/Espo/Core/Exceptions/BadRequest.php b/application/Espo/Core/Exceptions/BadRequest.php index 9c8ebd0a3b..b71f5954b1 100644 --- a/application/Espo/Core/Exceptions/BadRequest.php +++ b/application/Espo/Core/Exceptions/BadRequest.php @@ -29,13 +29,14 @@ namespace Espo\Core\Exceptions; +use Espo\Core\Utils\Log; use Throwable; use Exception; /** * A bad request exception. Main purpose is for the 400 Bad Request HTTP error. */ -class BadRequest extends Exception implements HasBody +class BadRequest extends Exception implements HasBody, HasLogLevel { /** @var int */ protected $code = 400; @@ -61,4 +62,9 @@ class BadRequest extends Exception implements HasBody { return $this->body; } + + public function getLogLevel(): string + { + return Log::LEVEL_WARNING; + } } diff --git a/application/Espo/Core/Exceptions/Forbidden.php b/application/Espo/Core/Exceptions/Forbidden.php index 4cbf2178b9..4b02337e07 100644 --- a/application/Espo/Core/Exceptions/Forbidden.php +++ b/application/Espo/Core/Exceptions/Forbidden.php @@ -29,13 +29,14 @@ namespace Espo\Core\Exceptions; +use Espo\Core\Utils\Log; use Throwable; use Exception; /** * A forbidden exception. Main purpose is for the 403 Forbidden HTTP error. */ -class Forbidden extends Exception implements HasBody +class Forbidden extends Exception implements HasBody, HasLogLevel { /** @var int */ protected $code = 403; @@ -62,4 +63,9 @@ class Forbidden extends Exception implements HasBody { return $this->body; } + + public function getLogLevel(): string + { + return Log::LEVEL_WARNING; + } } diff --git a/application/Espo/Core/Exceptions/NotFound.php b/application/Espo/Core/Exceptions/NotFound.php index dbfd2d04e5..748e9b5321 100644 --- a/application/Espo/Core/Exceptions/NotFound.php +++ b/application/Espo/Core/Exceptions/NotFound.php @@ -29,13 +29,19 @@ namespace Espo\Core\Exceptions; +use Espo\Core\Utils\Log; use Exception; /** * A not-found exception. Main purpose is for the 404 Not Found HTTP error. */ -class NotFound extends Exception +class NotFound extends Exception implements HasLogLevel { /** @var int */ protected $code = 404; + + public function getLogLevel(): string + { + return Log::LEVEL_WARNING; + } }