Implement failure cases in fetch artist image background job
This commit is contained in:
@@ -3,8 +3,18 @@ defmodule MusicLibrary.Worker.FetchArtistImage do
|
||||
|
||||
@impl Oban.Worker
|
||||
def perform(%Oban.Job{args: %{"id" => artist_id}}) do
|
||||
with {:ok, _artist_info} <- MusicLibrary.Artists.fetch_image(artist_id) do
|
||||
:ok
|
||||
case MusicLibrary.Artists.fetch_image(artist_id) do
|
||||
{:ok, _artist_info} ->
|
||||
:ok
|
||||
|
||||
{:error, :image_not_found} ->
|
||||
{:cancel, :image_not_found}
|
||||
|
||||
{:error, :no_discogs_data} ->
|
||||
{:cancel, :no_discogs_data}
|
||||
|
||||
error ->
|
||||
error
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user