Add error logging when mount/unmount fails

This commit is contained in:
Alexandre de Souza 2025-09-24 18:44:01 -03:00
parent d593e62ba6
commit f59d2f3e1d
No known key found for this signature in database
GPG key ID: E39228FFBA346545

View file

@ -1,6 +1,7 @@
defmodule Livebook.FileSystem.Mounter do
# This server is responsible to handle file systems that are mountable
use GenServer
require Logger
alias Livebook.{FileSystem, Hubs}
@ -98,7 +99,8 @@ defmodule Livebook.FileSystem.Mounter do
broadcast({:file_system_mounted, file_system})
put_hub_file_system(state, file_system)
{:error, _reason} ->
{:error, reason} ->
Logger.error("[file_system=#{name(file_system)}] failed to mount: #{reason}")
state
end
end
@ -109,7 +111,8 @@ defmodule Livebook.FileSystem.Mounter do
broadcast({:file_system_unmounted, file_system})
remove_hub_file_system(state, file_system)
{:error, _reason} ->
{:error, reason} ->
Logger.error("[file_system=#{name(file_system)}] failed to unmount: #{reason}")
state
end
end
@ -148,6 +151,10 @@ defmodule Livebook.FileSystem.Mounter do
put_in(hub_data.file_systems, file_systems)
end
defp name(file_system) do
FileSystem.external_metadata(file_system).name
end
if Mix.env() == :test do
defp broadcast({_, %{external_id: _, hub_id: id}} = message) do
Phoenix.PubSub.broadcast(Livebook.PubSub, "file_systems:#{id}", message)