From 0ad945d94dbc86321cf80fb9011b02da1ae0216b Mon Sep 17 00:00:00 2001 From: ruslandoga <67764432+ruslandoga@users.noreply.github.com> Date: Tue, 12 Nov 2024 21:51:11 +0700 Subject: [PATCH 1/2] document handle_info/2 --- lib/db_connection.ex | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/db_connection.ex b/lib/db_connection.ex index 60d4c4c..a19b737 100644 --- a/lib/db_connection.ex +++ b/lib/db_connection.ex @@ -362,6 +362,14 @@ defmodule DBConnection do """ @callback disconnect(err :: Exception.t(), state :: any) :: :ok + @doc """ + Optional callback for handling messages received by the connection. + Returns `{:disconnect, exception}` to close the connection or `:ok` to continue. + """ + @callback handle_info(message :: any, state :: any) :: {:disconnect, Exception.t()} | :ok + + @optional_callbacks handle_info: 2 + @connection_module_key :connection_module @doc """ From 577ffb9cd77ec61b4d63f1c89a8c065786e9fb28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Tue, 12 Nov 2024 16:00:59 +0100 Subject: [PATCH 2/2] Update lib/db_connection.ex --- lib/db_connection.ex | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/db_connection.ex b/lib/db_connection.ex index a19b737..10e27a0 100644 --- a/lib/db_connection.ex +++ b/lib/db_connection.ex @@ -364,6 +364,7 @@ defmodule DBConnection do @doc """ Optional callback for handling messages received by the connection. + Returns `{:disconnect, exception}` to close the connection or `:ok` to continue. """ @callback handle_info(message :: any, state :: any) :: {:disconnect, Exception.t()} | :ok