Catch ValueError at the end of a radio
This commit is contained in:
parent
8e2d686386
commit
5b7a28684a
|
@ -137,7 +137,12 @@ class RadioSessionTrackViewSet(mixins.CreateModelMixin, viewsets.GenericViewSet)
|
||||||
)
|
)
|
||||||
except AssertionError:
|
except AssertionError:
|
||||||
return Response(status=status.HTTP_403_FORBIDDEN)
|
return Response(status=status.HTTP_403_FORBIDDEN)
|
||||||
session.radio.pick()
|
try:
|
||||||
|
session.radio.pick()
|
||||||
|
except ValueError:
|
||||||
|
return Response(
|
||||||
|
"Radio doesn't have more candidates", status=status.HTTP_404_NOT_FOUND
|
||||||
|
)
|
||||||
session_track = session.session_tracks.all().latest("id")
|
session_track = session.session_tracks.all().latest("id")
|
||||||
# self.perform_create(serializer)
|
# self.perform_create(serializer)
|
||||||
# dirty override here, since we use a different serializer for creation and detail
|
# dirty override here, since we use a different serializer for creation and detail
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Catch ValueError on radio end (#1596)
|
|
@ -99,6 +99,11 @@ axios.interceptors.response.use(function (response) {
|
||||||
}
|
}
|
||||||
if (error.response.status === 404) {
|
if (error.response.status === 404) {
|
||||||
error.backendErrors.push('Resource not found')
|
error.backendErrors.push('Resource not found')
|
||||||
|
const message = error.response.data
|
||||||
|
store.commit('ui/addMessage', {
|
||||||
|
content: message,
|
||||||
|
class: 'error'
|
||||||
|
})
|
||||||
} else if (error.response.status === 403) {
|
} else if (error.response.status === 403) {
|
||||||
error.backendErrors.push('Permission denied')
|
error.backendErrors.push('Permission denied')
|
||||||
} else if (error.response.status === 429) {
|
} else if (error.response.status === 429) {
|
||||||
|
|
|
@ -97,8 +97,9 @@ export default {
|
||||||
dispatch('queue/last', null, { root: true })
|
dispatch('queue/last', null, { root: true })
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}, (response) => {
|
}, () => {
|
||||||
logger.default.error('Error while adding track to queue from radio')
|
logger.default.error('Error while adding track to queue from radio')
|
||||||
|
commit('reset')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue