From 4302218360aab2e940b142c10a6b9202ee4d525d Mon Sep 17 00:00:00 2001 From: Timothy Miller Date: Fri, 13 Sep 2024 21:43:47 +0900 Subject: [PATCH] Throw if refresh/access token null on refresh. --- src/FishyFlip/OAuth2SessionManager.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/FishyFlip/OAuth2SessionManager.cs b/src/FishyFlip/OAuth2SessionManager.cs index 1ea493fd..af5765ea 100644 --- a/src/FishyFlip/OAuth2SessionManager.cs +++ b/src/FishyFlip/OAuth2SessionManager.cs @@ -242,12 +242,12 @@ public void Dispose() var refreshResult = await this.oidcClient.RefreshTokenAsync(this.session!.RefreshJwt, backChannelParameters: null, scope: null, cancellationToken: cancellationToken); if (refreshResult.IsError) { - this.logger?.LogError($"Failed to refresh token: {refreshResult.Error} {refreshResult.ErrorDescription}"); + throw new OAuth2Exception($"Failed to refresh token: {refreshResult.Error} {refreshResult.ErrorDescription}"); } if (this.session is null) { - throw new NullReferenceException("Session should not be null if RefreshToken handler is enabled"); + throw new OAuth2Exception("Session should not be null if RefreshToken handler is enabled"); } lock (this.session)