Fix: Linter warnings (#137)
* Automaticly fixable eslint issues, mostly 3 -> 2 space indentation * fix: updated plex_userid to camelcase * Linted and some consistency refactor on middleware * eslint uses ecmaversion 2020 & allow empty catch rule * Started linting source files * Fixed eslint errors & improved a lot of error handling * Set 2 eslint rules as warning temporarly
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
const configuration = require("../../../config/configuration").getInstance();
|
||||
const TMDB = require("../../../tmdb/tmdb");
|
||||
|
||||
const tmdb = new TMDB(configuration.get("tmdb", "apiKey"));
|
||||
|
||||
const showCreditsController = (req, res) => {
|
||||
@@ -9,19 +10,12 @@ const showCreditsController = (req, res) => {
|
||||
.showCredits(showId)
|
||||
.then(credits => res.send(credits.createJsonResponse()))
|
||||
.catch(error => {
|
||||
const { status, message } = error;
|
||||
|
||||
if (status && message) {
|
||||
res.status(status).send({ success: false, message });
|
||||
} else {
|
||||
// TODO log unhandled errors
|
||||
console.log("caugth show credits controller error", error);
|
||||
res
|
||||
.status(500)
|
||||
.send({
|
||||
message: "An unexpected error occured while requesting show credits"
|
||||
});
|
||||
}
|
||||
return res.status(error?.statusCode || 500).send({
|
||||
success: false,
|
||||
message:
|
||||
error?.message ||
|
||||
`An unexpected error occured while requesting credits for show with id: ${showId}.`
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user