Skip to content

Commit

Permalink
allow a start error to properly propagate for the caller to take the …
Browse files Browse the repository at this point in the history
…appropriate action
  • Loading branch information
seb3s committed Nov 17, 2023
1 parent 7c91039 commit 5d407bb
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions lib/scenic.ex
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,17 @@ defmodule Scenic do
def start_link(vps \\ [])

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

# start the default ViewPort
Enum.each(vps, &Scenic.ViewPort.start(&1))
# return the original start_link value
{:ok, pid}

# return the original start_link value
{:ok, pid}
error ->
error
end
end

# --------------------------------------------------------
Expand Down

0 comments on commit 5d407bb

Please sign in to comment.