Skip to content

Commit

Permalink
[api][webui] Catch ActiveRecord::RecordInvalid errors when updating c…
Browse files Browse the repository at this point in the history
…hannels and report them to errbit.

Updating channels mostly happens via delayed jobs. To make such errors visible
we need to pipe exceptions to errbit to get aware of it.
  • Loading branch information
bgeuken committed Apr 11, 2016
1 parent d8bfa3c commit 6d62849
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/api/app/models/package.rb
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,15 @@ def find_changed_issues
def update_channel_list
if self.is_channel?
xml = Suse::Backend.get(self.source_path('_channel'))
self.channels.first_or_create.update_from_xml(xml.body.to_s)
begin
self.channels.first_or_create.update_from_xml(xml.body.to_s)
rescue ActiveRecord::RecordInvalid => e
if Rails.env.test?
raise e
else
HoptoadNotifier.notify(e, { failed_job: "Couldn't store channel" })
end
end
else
self.channels.destroy_all
end
Expand Down

0 comments on commit 6d62849

Please sign in to comment.