fix: friendly error for Spotify editorial playlist 403

Backend returns {error:'EDITORIAL_PLAYLIST'} on 403 playlist routes.
Frontend shows a step-by-step workaround card instead of a red error.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
HoneyandClaude Sonnet 4.6 committed 2026-05-09 23:22:56 +02:00
1 parent 468827571a
commit f7e4059f2d
2 files changed
+22 -1

No files matched your search

+19 -1
View File
@@ -66,13 +66,31 @@ export async function resolveSpotifyLink() {
});
if (!res.ok) {
const err = await res.json().catch(() => ({}));
throw new Error(err.error || `HTTP ${res.status}`);
if (err.error === 'EDITORIAL_PLAYLIST') throw new Error('EDITORIAL_PLAYLIST');
throw new Error(err.error || err.message || `HTTP ${res.status}`);
}
const data = await res.json();
window._spotifyResolved = data;
if (data.skippedLocal > 0) toast(`${data.skippedLocal} lokale Datei(en) übersprungen (kein Stream verfügbar)`);
_renderSpotifyPreview(data);
} catch(e) {
if (e.message === 'EDITORIAL_PLAYLIST') {
inner.innerHTML = `<div style="padding:16px;background:var(--surface);border-radius:10px;border-left:3px solid #1DB954">
<div style="font-weight:600;margin-bottom:10px;color:#1DB954">💡 Editorial Playlist erkannt</div>
<div style="font-size:13px;line-height:1.6;color:var(--text2)">
Spotify hat den API-Zugriff auf eigene kuratierte Playlists
(wie "Today's Top Hits", "Discover Weekly" etc.) für Drittanbieter-Apps gesperrt.<br><br>
<strong style="color:var(--text)">Lösung:</strong>
<ol style="margin:8px 0 0 0;padding-left:20px">
<li>In Spotify die Playlist öffnen</li>
<li>Alle Tracks markieren (Strg+A)</li>
<li>Rechtsklick → "Zu Playlist hinzufügen" → "Neue Playlist"</li>
<li>Diese eigene Kopie hier importieren</li>
</ol>
</div>
</div>`;
return;
}
if (e.message.includes('SPOTIFY_CLIENT_ID') ||
e.message.includes('Credentials fehlen') ||
e.message.includes('Spotify-Token-Fehler')) {