Skip to content

Commit 5d407bb

Browse files
committed
allow a start error to properly propagate for the caller to take the appropriate action
1 parent 7c91039 commit 5d407bb

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/scenic.ex

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,17 @@ defmodule Scenic do
6464
def start_link(vps \\ [])
6565

6666
def start_link(vps) when is_list(vps) do
67-
{:ok, pid} = Supervisor.start_link(__MODULE__, nil, name: :scenic)
67+
case Supervisor.start_link(__MODULE__, nil, name: :scenic) do
68+
{:ok, pid} ->
69+
# start the default ViewPort
70+
Enum.each(vps, &Scenic.ViewPort.start(&1))
6871

69-
# start the default ViewPort
70-
Enum.each(vps, &Scenic.ViewPort.start(&1))
72+
# return the original start_link value
73+
{:ok, pid}
7174

72-
# return the original start_link value
73-
{:ok, pid}
75+
error ->
76+
error
77+
end
7478
end
7579

7680
# --------------------------------------------------------

0 commit comments

Comments
 (0)