From 90c5a020ec8823efa425015ad630c5263320b5b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivan=20Verg=C3=A9s?= Date: Thu, 31 Oct 2024 11:08:36 +0100 Subject: [PATCH] raise error on failure --- app/services/microsoft_translator.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/services/microsoft_translator.rb b/app/services/microsoft_translator.rb index e2daa95..b589124 100644 --- a/app/services/microsoft_translator.rb +++ b/app/services/microsoft_translator.rb @@ -35,6 +35,7 @@ def translate_content body = JSON.parse(result.body).first if body.first == "error" Rails.logger.error("Microsoft Translator API error: #{body.second}") + raise StandardError, body else body["translations"].first["text"] end