Skip to content

Commit d3f1e6b

Browse files
authored
Merge pull request #339 from seb3s/patch-7
allow a start error to properly propagate
2 parents 0cdf1bd + 5d407bb commit d3f1e6b

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
@@ -61,13 +61,17 @@ defmodule Scenic do
6161
def start_link(vps \\ [])
6262

6363
def start_link(vps) when is_list(vps) do
64-
{:ok, pid} = Supervisor.start_link(__MODULE__, nil, name: :scenic)
64+
case Supervisor.start_link(__MODULE__, nil, name: :scenic) do
65+
{:ok, pid} ->
66+
# start the default ViewPort
67+
Enum.each(vps, &Scenic.ViewPort.start(&1))
6568

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

69-
# return the original start_link value
70-
{:ok, pid}
72+
error ->
73+
error
74+
end
7175
end
7276

7377
# --------------------------------------------------------

0 commit comments

Comments
 (0)