api error in case piped req fails

This commit is contained in:
unknown 2023-03-24 16:49:25 +01:00
parent 651d10aec0
commit 5430c9f397
1 changed files with 4 additions and 0 deletions

View File

@ -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({