1.0.6 - Display proper message for insufficient quota

This commit is contained in:
Carl-Robert Linnupuu 2023-02-21 20:07:20 +00:00
parent 2280e1b5f6
commit 8e4d836e08
3 changed files with 5 additions and 1 deletions

View file

@ -68,6 +68,9 @@ public final class ApiClient {
onMessage.accept("Incorrect API key provided.\n" +
"You can find your API key at https://platform.openai.com/account/api-keys.");
throw new IllegalArgumentException();
} else if (respInfo.statusCode() == 429) {
onMessage.accept("You exceeded your current quota, please check your plan and billing details.");
throw new RuntimeException("Insufficient quota");
} else {
onMessage.accept("Something went wrong. Please try again later.");
clearQueries();