Use friendly error messages in Last.fm callback

Closes #145
This commit is contained in:
Claudio Ortolina
2026-03-30 14:42:20 +01:00
parent b0018db89d
commit 45fd414f1b
4 changed files with 20 additions and 3 deletions
@@ -27,7 +27,7 @@ defmodule MusicLibraryWeb.LastFmControllerTest do
@tag :logged_out
@tag :capture_log
test "on error, redirects with error flash", %{conn: conn} do
test "on error, redirects with friendly error flash", %{conn: conn} do
error_json = %{
"error" => 4,
"message" => "Invalid authentication token"
@@ -40,7 +40,9 @@ defmodule MusicLibraryWeb.LastFmControllerTest do
conn = get(conn, ~p"/auth/last_fm/callback", %{"token" => "bad-token"})
assert redirected_to(conn) == "/"
assert conn.assigns.flash["error"] =~ "Failed to connect"
assert conn.assigns.flash["error"] ==
"Failed to connect your Last.fm account: Last.fm authentication failed"
end
end
end