Skip to content

Commit

Permalink
(fix) elixir-inspector#31 Don't crash on download failures
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-neal committed Jun 29, 2023
1 parent fef061f commit 83ece73
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/ua_inspector/downloader.ex
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,14 @@ defmodule UAInspector.Downloader do
end

defp download_file(remote, local) do
{:ok, content} = Config.downloader_adapter().read_remote(remote)

File.write!(local, content)
case Config.downloader_adapter().read_remote(remote) do
{:ok, content} ->
File.write!(local, content)
:ok

{:error, reason} ->
Logger.error("Failed to download file: #{reason}")
:ok
end
end
end

0 comments on commit 83ece73

Please sign in to comment.