Skip to content

Commit c8991da

Browse files
committed
Updated exception messages.
1 parent 21c72b2 commit c8991da

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Umbraco.AuthorizedServices/Services/Implement/AuthorizedServiceCaller.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,11 @@ private async Task<Token> EnsureAccessToken(string serviceAlias, Token token)
149149
if (string.IsNullOrEmpty(token.RefreshToken))
150150
{
151151
ClearAccessToken(serviceAlias);
152-
throw new AuthorizedServiceException($"Cannot request service '{serviceAlias}' as the access token has expired and no refresh token is available to use. The expired token has been deleted.");
152+
throw new AuthorizedServiceException($"Cannot request service '{serviceAlias}' as the access token has or will expire and no refresh token is available to use. The expired token has been deleted.");
153153
}
154154

155-
return await RefreshAccessToken(serviceAlias, token.RefreshToken) ?? throw new AuthorizedServiceException($"Cannot request service '{serviceAlias}' as the access token has expired and the refresh token could not be used to obtain a new access token.");
155+
return await RefreshAccessToken(serviceAlias, token.RefreshToken)
156+
?? throw new AuthorizedServiceException($"Cannot request service '{serviceAlias}' as the access token has or will expired and the refresh token could not be used to obtain a new access token.");
156157
}
157158

158159
return token;
@@ -185,7 +186,8 @@ private async Task<Token> EnsureExchangeAccessToken(string serviceAlias, Token t
185186
{
186187
if (token.WillBeExpiredAfter(TimeSpan.FromDays(30)))
187188
{
188-
return await RefreshExchangeAccessToken(serviceAlias, token.AccessToken) ?? throw new AuthorizedServiceException($"Cannot request service '{serviceAlias}' as the access token has expired and the refresh token could not be used to obtain a new access token.");
189+
return await RefreshExchangeAccessToken(serviceAlias, token.AccessToken)
190+
?? throw new AuthorizedServiceException($"Cannot request service '{serviceAlias}' as the access token will expire and it's not been possible to exchange it for a new access token.");
189191
}
190192

191193
return token;

0 commit comments

Comments
 (0)