Skip to content

Commit

Permalink
Merge pull request #165 from danschultzer/surface-retriever-startup-e…
Browse files Browse the repository at this point in the history
…rror

Surface retriever startup error
  • Loading branch information
kipcole9 authored Apr 20, 2024
2 parents 8c8cf50 + a739299 commit 344ae6d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lib/money/exchange_rates/exchange_rates_supervisor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ defmodule Money.ExchangeRates.Supervisor do
options = Keyword.merge(default_options(), options)
if options[:restart], do: stop()
supervisor = start_link()
if options[:start_retriever], do: ExchangeRates.Retriever.start()
if options[:start_retriever], do: start_retriever!()
supervisor
end

Expand Down Expand Up @@ -189,4 +189,11 @@ defmodule Money.ExchangeRates.Supervisor do
defp retriever_spec(config) do
%{id: @child_name, start: {@child_name, :start_link, [@child_name, config]}}
end

defp start_retriever! do
case ExchangeRates.Retriever.start() do
{:ok, _pid} -> :ok
{:error, reason} -> raise "Unhandled error starting retriever; #{inspect reason}"
end
end
end

0 comments on commit 344ae6d

Please sign in to comment.