Skip to content

Commit

Permalink
Add debug log about error in handling actions
Browse files Browse the repository at this point in the history
  • Loading branch information
FelonEkonom committed May 27, 2024
1 parent 5294057 commit a2d6202
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
18 changes: 18 additions & 0 deletions lib/membrane/core/callback_handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ defmodule Membrane.Core.CallbackHandler do
Error handling actions returned by callback #{inspect(state.module)}.#{callback}
""")

log_debug_orginal_error(actions, e, __STACKTRACE__)

reraise e, __STACKTRACE__
end

Expand All @@ -198,10 +200,26 @@ defmodule Membrane.Core.CallbackHandler do
Error handling action #{inspect(action)} returned by callback #{inspect(state.module)}.#{callback}
""")

log_debug_orginal_error(action, e, __STACKTRACE__)

reraise e, __STACKTRACE__
end
end)

handler_module.handle_end_of_actions(state)
end

defp log_debug_orginal_error(action_or_actions, error, stacktrace) do
action_or_actions =
if(is_list(action_or_actions), do: "actions ", else: "action ") <>
inspect(action_or_actions, limit: :infinity)

Membrane.Logger.debug("""
Error while handling #{action_or_actions}
Orginal error:
#{inspect(error, pretty: true, limit: :infinity)}
#{Exception.format_stacktrace(stacktrace)}
""")
end
end
2 changes: 1 addition & 1 deletion test/membrane/integration/links_validation_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ defmodule Membrane.LinksValidationTest do
]

{:error, {{%Membrane.LinkError{}, _stackstrace}, _meta}} =
Pipeline.start_supervised(spec: spec)
Pipeline.start_supervised(spec: [spec, spec])
end

test "dynamic pads" do
Expand Down

0 comments on commit a2d6202

Please sign in to comment.