Improve error logging when text cannot be extracted

[ci skip]
pull/6632/head
Oliver Günther 6 years ago
parent 0bbdcfc99b
commit 9a9a027483
No known key found for this signature in database
GPG Key ID: A3A8BDAD7C0C552C
  1. 12
      app/workers/extract_fulltext_job.rb

@ -49,17 +49,19 @@ class ExtractFulltextJob < ApplicationJob
private
def init
carrierwave_uploader = @attachment.file
@file = carrierwave_uploader.local_file
@filename = carrierwave_uploader.file.filename
begin
carrierwave_uploader = @attachment.file
@file = carrierwave_uploader.local_file
@filename = carrierwave_uploader.file.filename
if @attachment.readable?
resolver = Plaintext::Resolver.new(@file, @attachment.content_type)
@text = resolver.text
end
rescue => e
Rails.logger.error e.message
Rails.logger.error {
"Failed to extract plaintext from file #{@attachment.id} (On domain #{Setting.host_name}): #{e}: #{e.message}"
}
end
end

Loading…
Cancel
Save