Catch sort query error

This commit is contained in:
Florian Sylvain
2023-01-11 11:13:35 +01:00
parent a593d37a15
commit 0782f49725
+5
View File
@@ -40,6 +40,11 @@ showsRouter.get('/', function (req, res, next) {
prisma.serie.findMany(filter) prisma.serie.findMany(filter)
.then(shows => res.send({ shows })) .then(shows => res.send({ shows }))
.catch(error => {
if (error instanceof Prisma.PrismaClientValidationError) {
next(createHttpError(400, 'Incorrect field in sort query.'))
}
})
}) })
showsRouter.get('/:id', function (req, res, next) { showsRouter.get('/:id', function (req, res, next) {