From b66b912cd0c7e802c4b9b33e2d9f279e64db172d Mon Sep 17 00:00:00 2001 From: Angelo D'Ambrosio Date: Fri, 8 Mar 2024 15:39:13 +0100 Subject: [PATCH] ux: catch fatal whisper API error --- R/speech_to_text.R | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/R/speech_to_text.R b/R/speech_to_text.R index e7e978b..21be5ea 100644 --- a/R/speech_to_text.R +++ b/R/speech_to_text.R @@ -385,6 +385,10 @@ use_azure_whisper_stt <- function( # Make the HTTP request response <- httr::POST(url, headers, body = body) + if (response$status_code == 424) { + stop("Fatal error: ", httr::content(response, "text")) + } + # Check response status if (response$status_code != 200) {