Skip to content

Commit

Permalink
chore: log odesli album errors, and move on
Browse files Browse the repository at this point in the history
  • Loading branch information
pat committed Jul 24, 2023
1 parent 3cd387d commit 4fdf505
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
28 changes: 28 additions & 0 deletions app/lib/exceptions/log_for_album.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# frozen_string_literal: true

module Exceptions
class LogForAlbum
def self.call(...)
new(...).call
end

def initialize(error, album)
@error = error
@album = album
end

def call
Bugsnag.notify(error) do |report|
report.add_tab :album_info, {
:id => album.id,
:name => album.name,
:artist => album.artist.name
}
end
end

private

attr_reader :error, :album
end
end
2 changes: 2 additions & 0 deletions app/lib/parsers/odesli/links.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ def self.call
Album.with_spotify_url.each_unchecked("odesli") do |album|
new(album).call
sleep 1 # to avoid Odesli rate-limits.
rescue JSON::ParserError => error
Exceptions::LogForAlbum.call(error, album)
end
end

Expand Down

0 comments on commit 4fdf505

Please sign in to comment.