Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error messages #49

Merged
merged 6 commits into from
Jul 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/membrane_live_audio_mixer/live_queue.ex
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ defmodule Membrane.LiveAudioMixer.LiveQueue do
def add_queue(lq, id, offset \\ 0)

def add_queue(lq, id, offset) when offset >= 0 do
if get_in(lq, [:queues, id]) != nil, do: raise("Queue with id: '#{id}' already exists.")
if get_in(lq, [:queues, id]) != nil,
do: raise("Queue with id: '#{inspect(id)}' already exists.")

queue = %Queue{offset: offset}
put_in(lq, [:queues, id], queue)
Expand All @@ -54,13 +55,14 @@ defmodule Membrane.LiveAudioMixer.LiveQueue do
"""
@spec remove_queue(t(), any()) :: t()
def remove_queue(lq, id) do
if not Map.has_key?(lq.queues, id), do: raise("Queue with id: '#{id}' doesn't exists")
if not Map.has_key?(lq.queues, id),
do: raise("Queue with id: '#{inspect(id)}' doesn't exists")

queue = lq.queues[id]

cond do
queue.draining? ->
raise "Queue with id: '#{id}' is already marked as draining"
raise "Queue with id: '#{inspect(id)}' is already marked as draining"

queue.buffer_duration == 0 ->
{_queue, lq} = pop_in(lq, [:queues, id])
Expand Down
Loading