mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-10-25 12:56:13 +08:00
Add error logging when mount/unmount fails
This commit is contained in:
parent
d593e62ba6
commit
f59d2f3e1d
1 changed files with 9 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue