fix exceptions

This commit is contained in:
Yurii
2026-01-13 11:42:42 +02:00
parent 049be51f9c
commit 9f87a53f38
3 changed files with 12 additions and 12 deletions
@@ -31,7 +31,7 @@ namespace Espo\Entities;
use Espo\Core\Field\Date;
use Espo\Core\ORM\Entity;
use ValueError;
use UnexpectedValueException;
class CurrencyRecordRate extends Entity
{
@@ -81,7 +81,7 @@ class CurrencyRecordRate extends Entity
$record = $this->relations->getOne(self::FIELD_RECORD);
if (!$record instanceof CurrencyRecord) {
throw new ValueError("No record.");
throw new UnexpectedValueException("No record.");
}
return $record;
@@ -92,7 +92,7 @@ class CurrencyRecordRate extends Entity
$date = $this->getValueObject(self::FIELD_DATE);
if (!$date instanceof Date) {
throw new ValueError("No date.");
throw new UnexpectedValueException("No date.");
}
return $date;
+3 -3
View File
@@ -34,18 +34,18 @@ namespace Espo\Entities;
use Espo\Core\Field\DateTime;
use Espo\Core\ORM\Entity;
use SensitiveParameter;
use ValueError;
use UnexpectedValueException;
class OAuthAccount extends Entity
{
public const ENTITY_TYPE = 'OAuthAccount';
public const string ENTITY_TYPE = 'OAuthAccount';
public function getProvider(): OAuthProvider
{
$provider = $this->relations->getOne('provider');
if (!$provider instanceof OAuthProvider) {
throw new ValueError("No provider.");
throw new UnexpectedValueException("No provider.");
}
return $provider;
+6 -6
View File
@@ -33,11 +33,11 @@ namespace Espo\Entities;
use Espo\Core\ORM\Entity;
use stdClass;
use ValueError;
use UnexpectedValueException;
class OAuthProvider extends Entity
{
public const ENTITY_TYPE = 'OAuthProvider';
public const string ENTITY_TYPE = 'OAuthProvider';
public function isActive(): bool
{
@@ -49,7 +49,7 @@ class OAuthProvider extends Entity
$value = $this->get('clientId');
if (!is_string($value)) {
throw new ValueError("No client ID.");
throw new UnexpectedValueException("No client ID.");
}
return $value;
@@ -60,7 +60,7 @@ class OAuthProvider extends Entity
$value = $this->get('clientSecret');
if (!is_string($value)) {
throw new ValueError("No client secret.");
throw new UnexpectedValueException("No client secret.");
}
return $value;
@@ -71,7 +71,7 @@ class OAuthProvider extends Entity
$value = $this->get('tokenEndpoint');
if (!is_string($value)) {
throw new ValueError("No token endpoint.");
throw new UnexpectedValueException("No token endpoint.");
}
return $value;
@@ -82,7 +82,7 @@ class OAuthProvider extends Entity
$value = $this->get('authorizationEndpoint');
if (!is_string($value)) {
throw new ValueError("No authorization endpoint.");
throw new UnexpectedValueException("No authorization endpoint.");
}
return $value;