api error in case piped req fails
This commit is contained in:
parent
651d10aec0
commit
5430c9f397
|
@ -35,6 +35,8 @@ exports.getVideo = async (req, res) => {
|
|||
exports.getChannel = async (req, res) => {
|
||||
const videos = await metadata.getChannelVideos(req.params.id)
|
||||
const channel = await metadata.getChannel(req.params.id)
|
||||
|
||||
if (!videos || !channel) return res.json({ error: '500' })
|
||||
if (videos.error) return res.json({ error: '404' })
|
||||
|
||||
const archived = await prisma.videos.findMany({
|
||||
|
@ -86,6 +88,8 @@ exports.getChannel = async (req, res) => {
|
|||
|
||||
exports.getPlaylist = async (req, res) => {
|
||||
const playlist = await metadata.getPlaylistVideos(req.params.id)
|
||||
|
||||
if (!playlist) return res.json({ error: '500' })
|
||||
if (playlist.error) return res.json({ error: '404' })
|
||||
|
||||
const playlistArchived = await prisma.videos.findMany({
|
||||
|
|
Loading…
Reference in New Issue