Catch ValueError at the end of a radio
This commit is contained in:
parent
e076172106
commit
916e63eb09
|
@ -137,7 +137,12 @@ class RadioSessionTrackViewSet(mixins.CreateModelMixin, viewsets.GenericViewSet)
|
|||
)
|
||||
except AssertionError:
|
||||
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")
|
||||
# self.perform_create(serializer)
|
||||
# dirty override here, since we use a different serializer for creation and detail
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Catch ValueError on radio end (#1596)
|
|
@ -101,6 +101,11 @@ axios.interceptors.response.use(function (response) {
|
|||
}
|
||||
if (error.response.status === 404) {
|
||||
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) {
|
||||
error.backendErrors.push('Permission denied')
|
||||
} else if (error.response.status === 429) {
|
||||
|
|
|
@ -97,8 +97,9 @@ export default {
|
|||
dispatch('queue/last', null, { root: true })
|
||||
})
|
||||
}
|
||||
}, (response) => {
|
||||
}, () => {
|
||||
logger.default.error('Error while adding track to queue from radio')
|
||||
commit('reset')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue