Better handle exceptions in smart cells

This commit is contained in:
José Valim 2022-08-28 18:17:25 +02:00
parent ac67abd4e3
commit 713d1a55be
2 changed files with 7 additions and 3 deletions

View file

@ -104,8 +104,12 @@ defmodule Livebook.Runtime.ErlDist.LoggerGLBackend do
end
defp io_proxy?(pid) do
info = Process.info(pid, [:dictionary])
info[:dictionary][:"$initial_call"] == {Livebook.Runtime.Evaluator.IOProxy, :init, 1}
try do
info = Process.info(pid, [:dictionary])
info[:dictionary][:"$initial_call"] == {Livebook.Runtime.Evaluator.IOProxy, :init, 1}
rescue
_ -> false
end
end
def async_io(device, output) when is_pid(device) do

View file

@ -423,7 +423,7 @@ defmodule Livebook.Runtime.ErlDist.RuntimeServer do
put_in(state.smart_cells[ref], info)
{:error, error} ->
Logger.error("failed to start smart cell, reason: #{inspect(error)}")
Logger.error("failed to start smart cell - #{Exception.format_exit(error)}")
state
end