aboutsummaryrefslogtreecommitdiff
path: root/src/api/routes/albums
diff options
context:
space:
mode:
authorPitu <[email protected]>2018-09-18 03:52:49 -0300
committerPitu <[email protected]>2018-09-18 03:52:49 -0300
commit8ca6784eec8d8f1e4a9c4f6875704f09aae1103a (patch)
treee652ea6738384e5156f9d030365bc9e234cb1be0 /src/api/routes/albums
parentEnable changing album options (diff)
downloadhost.fuwn.me-8ca6784eec8d8f1e4a9c4f6875704f09aae1103a.tar.xz
host.fuwn.me-8ca6784eec8d8f1e4a9c4f6875704f09aae1103a.zip
Better error handling on invalid links
Diffstat (limited to 'src/api/routes/albums')
-rw-r--r--src/api/routes/albums/albumGET.js4
1 files changed, 2 insertions, 2 deletions
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)