Skip to content

Commit 38ae233

Browse files
committed
Use Logger.error to print original error while handling action returned by callback. Improve formatting.
1 parent c7afa10 commit 38ae233

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

lib/membrane/core/callback_handler.ex

+6-8
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ defmodule Membrane.Core.CallbackHandler do
185185
Error handling actions returned by callback #{inspect(state.module)}.#{callback}
186186
""")
187187

188-
log_debug_orginal_error(actions, e, __STACKTRACE__)
188+
log_error_orginal_error(actions, e, __STACKTRACE__)
189189

190190
reraise e, __STACKTRACE__
191191
end
@@ -197,10 +197,11 @@ defmodule Membrane.Core.CallbackHandler do
197197
rescue
198198
e ->
199199
Membrane.Logger.error("""
200-
Error handling action #{inspect(action)} returned by callback #{inspect(state.module)}.#{callback}
200+
Error handling action returned by callback #{inspect(state.module)}.#{callback}.
201+
Action: #{inspect(action, pretty: true)}
201202
""")
202203

203-
log_debug_orginal_error(action, e, __STACKTRACE__)
204+
log_error_orginal_error(action, e, __STACKTRACE__)
204205

205206
reraise e, __STACKTRACE__
206207
end
@@ -212,15 +213,12 @@ defmodule Membrane.Core.CallbackHandler do
212213
# We log it, because sometimes, for some reason, crashing process doesn't cause
213214
# printing error logs on stderr, so this debug log allows us to get some info
214215
# about what happened in case of process crash
215-
defp log_debug_orginal_error(action_or_actions, error, stacktrace) do
216+
defp log_error_orginal_error(action_or_actions, error, stacktrace) do
216217
action_or_actions =
217218
if(is_list(action_or_actions), do: "actions ", else: "action ") <>
218219
inspect(action_or_actions, limit: :infinity)
219220

220-
Membrane.Logger.debug("""
221-
Error while handling #{action_or_actions}
222-
223-
Orginal error:
221+
Membrane.Logger.error("""
224222
#{inspect(error, pretty: true, limit: :infinity)}
225223
#{Exception.format_stacktrace(stacktrace)}
226224
""")

0 commit comments

Comments
 (0)