Skip to content

Commit

Permalink
Error message is confusing if transport is nil (#292)
Browse files Browse the repository at this point in the history
  • Loading branch information
satoren authored Jun 17, 2024
1 parent 2cfbcd7 commit eb3900a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions lib/pipe_transport.ex
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ defmodule Mediasoup.PipeTransport do
GenServer.call(pid, {:consume, [option]})
end

def consume(transport, option) do
def consume(%PipeTransport{} = transport, option) do
consume(transport, Consumer.Options.from_map(option))
end

Expand All @@ -128,7 +128,7 @@ defmodule Mediasoup.PipeTransport do
GenServer.call(pid, {:consume_data, [option]})
end

def consume_data(transport, option) do
def consume_data(%PipeTransport{} = transport, option) do
consume_data(transport, DataConsumer.Options.from_map(option))
end

Expand All @@ -151,7 +151,7 @@ defmodule Mediasoup.PipeTransport do
GenServer.call(pid, {:produce, [option]})
end

def produce(transport, %{} = option) do
def produce(%PipeTransport{} = transport, %{} = option) do
produce(transport, Producer.Options.from_map(option))
end

Expand All @@ -165,7 +165,7 @@ defmodule Mediasoup.PipeTransport do
GenServer.call(pid, {:produce_data, [option]})
end

def produce_data(transport, %{} = option) do
def produce_data(%PipeTransport{} = transport, %{} = option) do
produce_data(transport, DataProducer.Options.from_map(option))
end

Expand Down
4 changes: 2 additions & 2 deletions lib/plain_transport.ex
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ defmodule Mediasoup.PlainTransport do
GenServer.call(pid, {:produce, [option]})
end

def produce(transport, %{} = option) do
def produce(%PlainTransport{} = transport, %{} = option) do
produce(transport, Producer.Options.from_map(option))
end

Expand All @@ -205,7 +205,7 @@ defmodule Mediasoup.PlainTransport do
GenServer.call(pid, {:consume, [option]})
end

def consume(transport, option) do
def consume(%PlainTransport{} = transport, option) do
consume(transport, Consumer.Options.from_map(option))
end

Expand Down
4 changes: 2 additions & 2 deletions lib/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ defmodule Mediasoup.Router do
GenServer.call(pid, {:create_webrtc_transport, [option]})
end

def create_webrtc_transport(router, %{} = option) do
def create_webrtc_transport(%Router{} = router, %{} = option) do
create_webrtc_transport(router, WebRtcTransport.Options.from_map(option))
end

Expand All @@ -148,7 +148,7 @@ defmodule Mediasoup.Router do
GenServer.call(pid, {:create_plain_transport, [option]})
end

def create_plain_transport(router, %{} = option) do
def create_plain_transport(%Router{} = router, %{} = option) do
create_plain_transport(router, Mediasoup.PlainTransport.Options.from_map(option))
end

Expand Down
8 changes: 4 additions & 4 deletions lib/webrtc_transport.ex
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ defmodule Mediasoup.WebRtcTransport do
GenServer.call(pid, {:consume, [option]})
end

def consume(transport, option) do
def consume(%WebRtcTransport{} = transport, option) do
consume(transport, Consumer.Options.from_map(option))
end

Expand All @@ -243,7 +243,7 @@ defmodule Mediasoup.WebRtcTransport do
GenServer.call(pid, {:consume_data, [option]})
end

def consume_data(transport, option) do
def consume_data(%WebRtcTransport{} = transport, option) do
consume_data(transport, DataConsumer.Options.from_map(option))
end

Expand All @@ -257,7 +257,7 @@ defmodule Mediasoup.WebRtcTransport do
GenServer.call(pid, {:produce, [option]})
end

def produce(transport, %{} = option) do
def produce(%WebRtcTransport{} = transport, %{} = option) do
produce(transport, Producer.Options.from_map(option))
end

Expand All @@ -271,7 +271,7 @@ defmodule Mediasoup.WebRtcTransport do
GenServer.call(pid, {:produce_data, [option]})
end

def produce_data(transport, %{} = option) do
def produce_data(%WebRtcTransport{} = transport, %{} = option) do
produce_data(transport, DataProducer.Options.from_map(option))
end

Expand Down

0 comments on commit eb3900a

Please sign in to comment.