Packages
membrane_core
0.6.0
1.3.4
1.3.3
1.3.2
1.3.1
1.3.0
1.2.7
1.2.6
1.2.5
retired
1.2.4
1.2.3
1.2.2
1.2.1
1.2.0
1.2.0-rc1
1.1.2
1.1.1
1.1.0
1.1.0-rc1
1.1.0-rc0
1.0.1
1.0.0
1.0.0-rc1
1.0.0-rc0
0.12.9
0.12.8
0.12.7
0.12.6
0.12.5
0.12.4
0.12.3
0.12.2
0.12.1
0.12.0
retired
0.11.5
0.11.4
0.11.3
0.11.2
0.11.1
0.11.0
0.10.2
0.10.1
0.10.0
0.9.0
0.8.2
0.8.1
0.8.0
0.7.0
0.6.1
0.6.0
0.5.3
0.5.2
0.5.1
0.5.0
0.4.3
0.4.2
0.4.1
0.4.0
0.3.2
0.3.1
0.3.0
0.2.2
0.2.1
0.2.0
0.1.1
0.1.0
Membrane Multimedia Framework (Core)
Current section
Files
Jump to
Current section
Files
lib/membrane/exceptions.ex
defmodule Membrane.PipelineError do
defexception [:message]
end
defmodule Membrane.ParentError do
defexception [:message]
end
defmodule Membrane.CallbackError do
defexception [:message]
@impl true
def exception(opts) do
kind = Keyword.fetch!(opts, :kind)
callback = Keyword.fetch!(opts, :callback)
mk_exception(kind, callback, opts)
end
defp mk_exception(:bad_return, {module, fun}, opts) do
val = Keyword.fetch!(opts, :val)
msg = """
Invalid value returned from #{inspect(module)}.#{inspect(fun)}:
#{inspect(val, pretty: true)}
"""
%__MODULE__{message: msg}
end
defp mk_exception(:invalid_action, {module, fun}, opts) do
action = Keyword.fetch!(opts, :action)
msg = """
Invalid action returned from #{inspect(module)}.#{to_string(fun)}:
#{inspect(action, pretty: true)}\
"""
%__MODULE__{message: msg}
end
defp mk_exception(:error, {module, fun}, opts) do
reason = Keyword.fetch!(opts, :reason)
msg = """
Error returned from #{inspect(module)}.#{fun}:
#{inspect(reason, pretty: true)}
"""
%__MODULE__{message: msg}
end
end
defmodule Membrane.ActionError do
defexception [:message]
@impl true
def exception(opts) do
{action, args} = Keyword.fetch!(opts, :action)
{module, fun} = Keyword.fetch!(opts, :callback)
reason = Keyword.fetch!(opts, :reason)
msg = """
Error while handling #{inspect(action)} action:
#{format_reason(reason)}
Callback: #{inspect(module)}.#{fun}
Action args: #{inspect(args, pretty: true)}\
"""
%__MODULE__{message: msg}
end
defp format_reason({:playback_state, playback_state}) do
"Cannot invoke this action in #{playback_state} state."
end
defp format_reason(:actions_after_redemand) do
"Redemand action has to be last in actions list."
end
defp format_reason({:invalid_buffer, buffer}) do
"Invalid buffer: #{inspect(buffer, pretty: true)}"
end
defp format_reason({:unknown_pad, pad}) do
"The pad #{inspect(pad)} does not exist"
end
defp format_reason({:invalid_pad_dir, pad, dir}) do
"Cannot invoke this action on pad #{inspect(pad)} as it has #{inspect(dir)} direction"
end
defp format_reason({:invalid_pad_mode, pad, mode}) do
"Cannot invoke this action on pad #{inspect(pad)} as it works in #{inspect(mode)} mode"
end
defp format_reason({:eos_sent, pad}) do
"End of Stream has already been sent on pad #{inspect(pad)}"
end
defp format_reason({:invalid_caps, caps, accepted_caps}) do
"""
Trying to send caps that do not match the specification
Caps being sent: #{inspect(caps, pretty: true)}
Allowed caps spec: #{inspect(accepted_caps, pretty: true)}\
"""
end
defp format_reason(:negative_demand) do
"Requested demand must be positive"
end
defp format_reason({:invalid_event, event}) do
"Invalid event: #{inspect(event, pretty: true)}"
end
defp format_reason(reason) do
"Unknown error: #{inspect(reason, pretty: true)}"
end
end
defmodule Membrane.LinkError do
defexception [:message]
end