mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-10-08 12:36:36 +08:00
Fix error recovery when serializing unknown structs in JS view payload
This commit is contained in:
parent
732db0ed45
commit
6853bbd9a1
1 changed files with 8 additions and 5 deletions
|
@ -105,12 +105,15 @@ defmodule LivebookWeb.JSViewChannel do
|
|||
defp run_safely(fun) do
|
||||
try do
|
||||
{:ok, fun.()}
|
||||
catch
|
||||
:error, %Protocol.UndefinedError{protocol: Jason.Encoder, value: value} ->
|
||||
{:error, "value #{inspect(value)} is not JSON-serializable, use another data type"}
|
||||
rescue
|
||||
error ->
|
||||
case error do
|
||||
%Protocol.UndefinedError{protocol: Jason.Encoder, value: value} ->
|
||||
{:error, "value #{inspect(value)} is not JSON-serializable, use another data type"}
|
||||
|
||||
:error, error ->
|
||||
{:error, Exception.message(error)}
|
||||
error ->
|
||||
{:error, Exception.message(error)}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue