Skip to content

Commit

Permalink
#405 Improve invalid oauth key exception messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Viincenttt committed Nov 12, 2024
1 parent 3fcf97a commit a216c85
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Mollie.Api/Client/BaseMollieClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,11 @@ protected void ValidateApiKeyIsOauthAccesstoken(bool isConstructor = false) {
if (!apiKey.StartsWith("access_")) {
if (isConstructor) {
throw new InvalidOperationException(
"The provided token isn't an oauth token. You have invoked the method with oauth parameters thus an oauth accesstoken is required.");
"The provided token isn't an oauth token. Are you trying to use oauth specific clients using an API key?");
}

throw new ArgumentException("The provided token isn't an oauth token.");
throw new InvalidOperationException(
"The provided token isn't an oauth token. Are you trying to use oauth specific parameters such as ProfileId or TestMode using an API key?");
}
}

Expand Down

0 comments on commit a216c85

Please sign in to comment.