Skip to content

Commit

Permalink
raise error on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
microstudi committed Oct 31, 2024
1 parent 1c2d1c8 commit 90c5a02
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions app/services/microsoft_translator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 90c5a02

Please sign in to comment.