Browse Source

Error consistency

Pitu 6 years ago
parent
commit
dd98cecfeb

+ 1 - 2
src/api/routes/albums/albumDELETE.js

@@ -30,8 +30,7 @@ class albumDELETE extends Route {
 			await db.table('albums').where({ id }).delete();
 			return res.json({ message: 'The album was deleted successfully' });
 		} catch (error) {
-			log.error(error);
-			return res.json({ message: 'There was a problem deleting the album' });
+			return super.error(res, error);
 		}
 	}
 }

+ 0 - 1
src/api/routes/albums/link/linkDELETE.js

@@ -23,7 +23,6 @@ class linkDELETE extends Route {
 				.where({ linkId: link.id })
 				.delete();
 		} catch (error) {
-			console.log(error);
 			return super.error(res, error);
 		}
 

+ 1 - 2
src/api/routes/albums/link/linkEditPOST.js

@@ -26,8 +26,7 @@ class linkEditPOST extends Route {
 				});
 			return res.json({ message: 'Editing the link was successful' });
 		} catch (error) {
-			log.error(error);
-			return res.json({ message: 'There was a problem editing the link' });
+			return super.error(res, error);
 		}
 	}
 }

+ 1 - 2
src/api/routes/albums/link/linkPOST.js

@@ -46,8 +46,7 @@ class linkPOST extends Route {
 				identifier
 			});
 		} catch (error) {
-			log.error(error);
-			return res.status(500).json({ message: 'There was a problem creating the link' });
+			return super.error(res, error);
 		}
 	}
 }