Log error message inline when Feeds::Import fails (#12012)
This commit is contained in:
parent
92fdf8d720
commit
00247bed99
2 changed files with 12 additions and 2 deletions
|
|
@ -151,8 +151,9 @@ module Feeds
|
|||
end
|
||||
|
||||
def report_error(error, metadata)
|
||||
Rails.logger.error("feeds::import::error::#{error.class}::#{metadata}")
|
||||
Rails.logger.error(error)
|
||||
Rails.logger.error(
|
||||
"feeds::import::error::#{error.class}::#{metadata.merge(error_message: error.message)}",
|
||||
)
|
||||
end
|
||||
|
||||
def item_count_error(feed)
|
||||
|
|
|
|||
|
|
@ -96,6 +96,15 @@ RSpec.describe Feeds::Import, type: :service, vcr: true, db_strategy: :truncatio
|
|||
|
||||
expect(Rails.logger).to have_received(:error).at_least(:once)
|
||||
end
|
||||
|
||||
it "logs the error message" do
|
||||
allow(Feedjira).to receive(:parse).and_raise("this is an error")
|
||||
allow(Rails.logger).to receive(:error)
|
||||
|
||||
described_class.call
|
||||
|
||||
expect(Rails.logger).to have_received(:error).at_least(:once).with(/error_message=>"this is an error"/)
|
||||
end
|
||||
end
|
||||
|
||||
context "with an explicit set of users", vcr: { cassette_name: "feeds_import" } do
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue