Fix crash with wrong spotify username
This commit is contained in:
parent
f279ed43b5
commit
516eb2557f
@ -10,7 +10,13 @@ const handler: ApiHandler['handler'] = async (req, res) => {
|
|||||||
const sp = deemix.plugins.spotify.sp
|
const sp = deemix.plugins.spotify.sp
|
||||||
const username = req.query.spotifyUser
|
const username = req.query.spotifyUser
|
||||||
data = []
|
data = []
|
||||||
let playlists = await sp.getUserPlaylists(username)
|
let playlists
|
||||||
|
try {
|
||||||
|
playlists = await sp.getUserPlaylists(username)
|
||||||
|
} catch (e) {
|
||||||
|
res.send({ error: 'wrongSpotifyUsername', username })
|
||||||
|
return
|
||||||
|
}
|
||||||
playlists = playlists.body
|
playlists = playlists.body
|
||||||
let playlistList = playlists.items
|
let playlistList = playlists.items
|
||||||
while (playlists.next) {
|
while (playlists.next) {
|
||||||
|
Loading…
Reference in New Issue
Block a user