throw on save error

This commit is contained in:
Artem Vasilev 2024-03-12 23:25:00 +03:00
parent 665f4ac2d4
commit 0caade0e28
3 changed files with 15 additions and 6 deletions

View File

@ -74,7 +74,10 @@ class AccessTokenRepository implements AccessTokenRepositoryInterface
$data['client_id'] = $client->id;
unset($data['client_identifier']);
$this->accessTokenModel->save($data);
if (!$this->accessTokenModel->save($data))
{
throw new \RuntimeException($this->accessTokenModel->getError());
}
}
public function revokeAccessToken($tokenId): void
@ -86,7 +89,7 @@ class AccessTokenRepository implements AccessTokenRepositoryInterface
* @param string $tokenId
*
* @throws \Exception
* @since version
* @since version
* @noinspection PhpPossiblePolymorphicInvocationInspection
*/
public function isAccessTokenRevoked($tokenId): bool

View File

@ -70,7 +70,10 @@ class AuthCodeRepository implements AuthCodeRepositoryInterface
$data['client_id'] = $client->id;
unset($data['client_identifier']);
$this->authCodeModel->save($data);
if (!$this->authCodeModel->save($data))
{
throw new \RuntimeException($this->authCodeModel->getError());
}
}
public function revokeAuthCode($codeId): void
@ -82,7 +85,7 @@ class AuthCodeRepository implements AuthCodeRepositoryInterface
* @param string $codeId
*
* @throws \Exception
* @since version
* @since version
* @noinspection PhpPossiblePolymorphicInvocationInspection
*/
public function isAuthCodeRevoked($codeId): bool

View File

@ -72,7 +72,10 @@ class RefreshTokenRepository implements RefreshTokenRepositoryInterface
unset($data['access_token_identifier']);
$data['access_token_id'] = $accessToken->id;
$this->refreshTokenModel->save($data);
if (!$this->refreshTokenModel->save($data))
{
throw new \RuntimeException($this->refreshTokenModel->getError());
}
}
public function revokeRefreshToken($tokenId): void
@ -84,7 +87,7 @@ class RefreshTokenRepository implements RefreshTokenRepositoryInterface
* @param string $tokenId
*
* @throws \Exception
* @since version
* @since version
* @noinspection PhpPossiblePolymorphicInvocationInspection
*/
public function isRefreshTokenRevoked($tokenId): bool