From d78a3cf86530a6472ce9408bda7a04030ac893b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Fri, 12 Nov 2021 14:36:02 +0100 Subject: [PATCH] Include reason if we can't start Livebook, closes #703 (#705) --- lib/livebook_cli/server.ex | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/lib/livebook_cli/server.ex b/lib/livebook_cli/server.ex index ef418eeae..4ae987bdd 100644 --- a/lib/livebook_cli/server.ex +++ b/lib/livebook_cli/server.ex @@ -68,13 +68,15 @@ defmodule LivebookCLI.Server do ) :available -> - case start_server() do - :ok -> + # We configure the endpoint with `server: true`, + # so it's gonna start listening + case Application.ensure_all_started(:livebook) do + {:ok, _} -> open_from_options(LivebookWeb.Endpoint.access_url(), opts) Process.sleep(:infinity) - :error -> - print_error("Livebook failed to start") + {:error, error} -> + print_error("Livebook failed to start with reason: #{inspect(error)}") end end end @@ -111,15 +113,6 @@ defmodule LivebookCLI.Server do end end - defp start_server() do - # We configure the endpoint with `server: true`, - # so it's gonna start listening - case Application.ensure_all_started(:livebook) do - {:ok, _} -> :ok - {:error, _} -> :error - end - end - defp open_from_options(base_url, opts) do if opts[:open] do browser_open(base_url)