Skip to content

Commit 02f22e9

Browse files
committed
Add repo name to "not found" errors
Retain repo name in the state of DBConnection.Ownership.Manager for the sake of clearer errors. Before: `** (DBConnection.OwnershipError) cannot find ownership process for #PID<0.1128.0> ({Phoenix.LiveView, MyAppWeb.FooLive, "lv:phx-GHKljxU3bpZfbx9j"}) using mode :manual` After: `** (DBConnection.OwnershipError) cannot find ownership process for #PID<0.1128.0> ({Phoenix.LiveView, MyAppWeb.FooLive, "lv:phx-GHKljxU3bpZfbx9j"}) using mode :manual on repo MyApp.Repo`
1 parent 7f71719 commit 02f22e9

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/db_connection/ownership/manager.ex

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ defmodule DBConnection.Ownership.Manager do
107107
mode: mode,
108108
mode_ref: nil,
109109
ets: ets,
110-
log: log
110+
log: log,
111+
repo: pool_opts[:repo]
111112
}}
112113
end
113114

@@ -223,7 +224,7 @@ defmodule DBConnection.Ownership.Manager do
223224
{:noreply, state}
224225

225226
:not_found when mode == :manual ->
226-
not_found(from, mode)
227+
not_found(from, mode, state.repo)
227228
{:noreply, state}
228229

229230
:not_found ->
@@ -393,10 +394,10 @@ defmodule DBConnection.Ownership.Manager do
393394
caller
394395
end
395396

396-
defp not_found({pid, _} = from, mode) do
397+
defp not_found({pid, _} = from, mode, repo) do
397398
msg = """
398399
cannot find ownership process for #{Util.inspect_pid(pid)}
399-
using mode #{inspect(mode)}.
400+
using mode #{inspect(mode)} on repo #{inspect(repo)}
400401
401402
When using ownership, you must manage connections in one
402403
of the four ways:

0 commit comments

Comments
 (0)