From 0e4063842b23fba099d42aee116253a4b843ad22 Mon Sep 17 00:00:00 2001 From: "feliks.pobiedzinski@swmansion.com" Date: Mon, 29 Jan 2024 15:30:34 +0100 Subject: [PATCH] Add assertion on value passed with :setup action --- lib/membrane/core/lifecycle_controller.ex | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/membrane/core/lifecycle_controller.ex b/lib/membrane/core/lifecycle_controller.ex index 1c1d62387..5e4e03f72 100644 --- a/lib/membrane/core/lifecycle_controller.ex +++ b/lib/membrane/core/lifecycle_controller.ex @@ -56,5 +56,13 @@ defmodule Membrane.Core.LifecycleController do """ end + defp assert_operation_allowed!(operation, _status) + when operation not in [:incomplete, :complete] do + raise SetupError, """ + Action {:setup, #{inspect(operation)}} was returned, but second element in the tuple must + be :complete or :incomplete + """ + end + defp assert_operation_allowed!(_operation, _status), do: :ok end