From 713d1a55be96eaea1918c9cf822a4e1795ffedca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sun, 28 Aug 2022 18:17:25 +0200 Subject: [PATCH] Better handle exceptions in smart cells --- lib/livebook/runtime/erl_dist/logger_gl_backend.ex | 8 ++++++-- lib/livebook/runtime/erl_dist/runtime_server.ex | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/livebook/runtime/erl_dist/logger_gl_backend.ex b/lib/livebook/runtime/erl_dist/logger_gl_backend.ex index 2888f7032..2fc0b6700 100644 --- a/lib/livebook/runtime/erl_dist/logger_gl_backend.ex +++ b/lib/livebook/runtime/erl_dist/logger_gl_backend.ex @@ -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 diff --git a/lib/livebook/runtime/erl_dist/runtime_server.ex b/lib/livebook/runtime/erl_dist/runtime_server.ex index 0f35d6c83..bad20d528 100644 --- a/lib/livebook/runtime/erl_dist/runtime_server.ex +++ b/lib/livebook/runtime/erl_dist/runtime_server.ex @@ -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