request endpoint finds type by body not query. Better error handling on what goes wrong if incorrect type or missing body parameter.

This commit is contained in:
2018-10-30 20:34:26 +01:00
parent 7e46d32e30
commit 4250b1bd17
2 changed files with 15 additions and 10 deletions

View File

@@ -88,7 +88,7 @@ class TMDB {
return Promise.resolve()
.then(() => this.cache.get(cacheKey))
.catch(() => this.tmdb('movieInfo', query))
.catch(() => { throw new Error('Could not find a movie with that id.'); })
.catch((error) => { console.log(error); throw new Error('Could not find a movie with that id.'); })
.then(response => this.cache.set(cacheKey, response))
.then((response) => {
try {