Commit a49d776f authored by azul's avatar azul

Merge branch 'rescue-index-err' into 'master'

fix: rescue failing attempts at saving page terms.

See merge request !224
parents aaefa16d 0502aa7c
......@@ -156,7 +156,16 @@ module Page::Index
# additional hook for subclasses
custom_page_terms(terms)
terms.save! if !new_record? and terms.changed?
begin
terms.save! if !new_record? and terms.changed?
rescue => exception
# page terms sometimes cause mysql exceptions
# We still need the surrounding context to continue to work.
# So we won't reraise here.
Rails.logger.error "ERROR - investigate me!"
Rails.logger.error "Failed to update page terms: #{terms.id} for page: #{id}."
Rails.logger.error exception
end
end
# :nodoc:
......
......@@ -37,7 +37,7 @@ class AssetPage < Page
thumbnail = asset.thumbnail(:txt)
thumbnail.generate unless File.exist?(thumbnail.private_filename)
begin
File.open(thumbnail.private_filename).read
File.open(thumbnail.private_filename, encoding: 'iso-8859-1').read
rescue
''
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment