From 8ca6784eec8d8f1e4a9c4f6875704f09aae1103a Mon Sep 17 00:00:00 2001 From: Pitu <7425261+Pitu@users.noreply.github.com> Date: Tue, 18 Sep 2018 03:52:49 -0300 Subject: Better error handling on invalid links --- src/api/routes/albums/albumGET.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/api/routes/albums/albumGET.js') diff --git a/src/api/routes/albums/albumGET.js b/src/api/routes/albums/albumGET.js index b63811c..f5e339f 100644 --- a/src/api/routes/albums/albumGET.js +++ b/src/api/routes/albums/albumGET.js @@ -16,13 +16,13 @@ class albumGET extends Route { Make sure it exists and it's enabled */ const link = await db.table('links').where({ identifier, enabled: true }).first(); - if (!link) return res.status(400).json({ message: 'The identifier supplied could not be found' }); + if (!link) return res.status(404).json({ message: 'The identifier supplied could not be found' }); /* Same with the album, just to make sure is not a deleted album and a leftover link */ const album = await db.table('albums').where('id', link.albumId).first(); - if (!album) return res.status(400).json({ message: 'Album not found' }); + if (!album) return res.status(404).json({ message: 'Album not found' }); /* Grab the files in a very unoptimized way. (This should be a join between both tables) -- cgit v1.2.3