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; $data['client_id'] = $client->id;
unset($data['client_identifier']); unset($data['client_identifier']);
$this->accessTokenModel->save($data); if (!$this->accessTokenModel->save($data))
{
throw new \RuntimeException($this->accessTokenModel->getError());
}
} }
public function revokeAccessToken($tokenId): void public function revokeAccessToken($tokenId): void

View File

@ -70,7 +70,10 @@ class AuthCodeRepository implements AuthCodeRepositoryInterface
$data['client_id'] = $client->id; $data['client_id'] = $client->id;
unset($data['client_identifier']); unset($data['client_identifier']);
$this->authCodeModel->save($data); if (!$this->authCodeModel->save($data))
{
throw new \RuntimeException($this->authCodeModel->getError());
}
} }
public function revokeAuthCode($codeId): void public function revokeAuthCode($codeId): void

View File

@ -72,7 +72,10 @@ class RefreshTokenRepository implements RefreshTokenRepositoryInterface
unset($data['access_token_identifier']); unset($data['access_token_identifier']);
$data['access_token_id'] = $accessToken->id; $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 public function revokeRefreshToken($tokenId): void