From 83c9e8cb2d7a4210c24745907b4a85c7e1b2b0b0 Mon Sep 17 00:00:00 2001 From: Kristian Date: Thu, 20 Jun 2024 17:10:07 -0700 Subject: [PATCH] Added exception inside generate_xml_transcript, which was throwing error on prod (#122) --- app/models/oral_history_item.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/app/models/oral_history_item.rb b/app/models/oral_history_item.rb index e639d7c3..f34814e5 100644 --- a/app/models/oral_history_item.rb +++ b/app/models/oral_history_item.rb @@ -416,12 +416,16 @@ def self.find_or_new(id) end def self.generate_xml_transcript(url) - tmpl = Nokogiri::XSLT(File.read('public/convert.xslt')) - resp = Net::HTTP.get(URI(url)) + begin + tmpl = Nokogiri::XSLT(File.read('public/convert.xslt')) + resp = Net::HTTP.get(URI(url)) - document = Nokogiri::XML(resp) + document = Nokogiri::XML(resp) - tmpl.transform(document).to_xml + tmpl.transform(document).to_xml + rescue => exception + OralHistoryItem.index_logger.error("#{exception.message}\n#{exception.backtrace}") + end end def self.total_records(args = {})