Skip to content

Commit 5665ea2

Browse files
authored
Fix stream_async return error message (#4240)
* Fix stream_async return error message * Fix typo in stream_async Enumerable error message
1 parent 0e17b5b commit 5665ea2

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

lib/phoenix_live_view/async.ex

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ defmodule Phoenix.LiveView.Async do
207207
:ok
208208
else
209209
raise ArgumentError, """
210-
expected stream_async to return {:ok, Enumerable.t()}, {:ok, Enumerable.t(), options} or {:error, reason} but the result
211-
is does not implement the Enumerable protocol
210+
expected stream_async to return {:ok, Enumerable.t()}, {:ok, Enumerable.t(), opts} or {:error, reason} but the result
211+
does not implement the Enumerable protocol
212212
"""
213213
end
214214
end
@@ -229,7 +229,7 @@ defmodule Phoenix.LiveView.Async do
229229

230230
other ->
231231
raise ArgumentError, """
232-
expected stream_async to return {:ok, Enumerable.t()} or {:error, reason}, got: #{inspect(other)}
232+
expected stream_async to return {:ok, Enumerable.t()}, {:ok, Enumerable.t(), opts} or {:error, reason}, got: #{inspect(other)}
233233
"""
234234
end
235235
end

test/phoenix_live_view/integrations/stream_async_test.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ defmodule Phoenix.LiveView.StreamAsyncTest do
1818
{:ok, lv, _html} = live(conn, "/stream_async?test=bad_return")
1919

2020
assert render_async(lv) =~
21-
"expected stream_async to return {:ok, Enumerable.t()} or {:error, reason}, got: 123"
21+
"expected stream_async to return {:ok, Enumerable.t()}, {:ok, Enumerable.t(), opts} or {:error, reason}, got: 123"
2222
end
2323

2424
test "not enumerable", %{conn: conn} do
@@ -188,7 +188,7 @@ defmodule Phoenix.LiveView.StreamAsyncTest do
188188
{:ok, lv, _html} = live(conn, "/stream_async?test=lc_bad_return")
189189

190190
assert render_async(lv) =~
191-
"expected stream_async to return {:ok, Enumerable.t()} or {:error, reason}, got: 123"
191+
"expected stream_async to return {:ok, Enumerable.t()}, {:ok, Enumerable.t(), opts} or {:error, reason}, got: 123"
192192
end
193193

194194
test "not enumerable", %{conn: conn} do

0 commit comments

Comments
 (0)