From c5aaf466720357b1ab348b05edb8882ac3ee1415 Mon Sep 17 00:00:00 2001 From: Andrej Date: Mon, 27 May 2024 18:03:14 +0200 Subject: [PATCH] Improve error handling for empty text extraction [SCI-10734] --- lib/active_storage/analyzer/text_extraction_analyzer.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/active_storage/analyzer/text_extraction_analyzer.rb b/lib/active_storage/analyzer/text_extraction_analyzer.rb index df2f9bd59..5925f042b 100644 --- a/lib/active_storage/analyzer/text_extraction_analyzer.rb +++ b/lib/active_storage/analyzer/text_extraction_analyzer.rb @@ -58,6 +58,8 @@ module ActiveStorage asset.update_estimated_size Rails.logger.info "Asset #{asset.id}: file text successfully extracted" + rescue ActiveRecord::RecordInvalid => e + Rails.logger.error "Asset #{asset.id}: file text unsuccessfully extracted with error #{e.message}" end { text_extracted: true }