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:
1 parent
468827571a
commit
f7e4059f2d
2 files changed
+22
-1
No files matched your search
@@ -276,6 +276,9 @@ app.post('/api/spotify/resolve', async (req, res) => {
|
||||
res.status(400).json({ error: `Unbekannter Typ: ${type}` });
|
||||
} catch(e) {
|
||||
console.error('[spotify/resolve]', e.message);
|
||||
if (e.message.includes('403') && e.message.includes('/playlists/')) {
|
||||
return res.status(403).json({ error: 'EDITORIAL_PLAYLIST' });
|
||||
}
|
||||
res.status(500).json({ error: e.message });
|
||||
}
|
||||
});
|
||||
|
||||
+19
-1
@@ -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')) {
|
||||
|
||||
Reference in new issue
Block a user