Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Surface retriever startup error #165

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading