Skip to content

Commit b223792

Browse files
author
tmcdonnell2
committed
Add new catch for RuntimeException to ChatGptService.java in order to allow for correct path to indicate to users that something went wrong.
1 parent cf43e51 commit b223792

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

application/src/main/java/org/togetherjava/tjbot/features/chaptgpt/ChatGptService.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ public Optional<String> ask(String question) {
7373
"There was an error using the OpenAI API: {} Code: {} Type: {} Status Code: {}",
7474
openAiHttpException.getMessage(), openAiHttpException.code,
7575
openAiHttpException.type, openAiHttpException.statusCode);
76+
} catch (RuntimeException runtimeException) {
77+
logger.warn("There was an error using the OpenAI API: {}",
78+
runtimeException.getMessage());
7679
}
7780
return Optional.empty();
7881
}

0 commit comments

Comments
 (0)