lower exceptions log levels
This commit is contained in:
@@ -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}'.");
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user