Now the server does not crash when unable to search plex.
This commit is contained in:
@@ -6,7 +6,12 @@ class PlexRepository {
|
|||||||
inPlex(tmdbResult) {
|
inPlex(tmdbResult) {
|
||||||
return Promise.resolve()
|
return Promise.resolve()
|
||||||
.then(() => this.search(tmdbResult.title))
|
.then(() => this.search(tmdbResult.title))
|
||||||
.then(plexResult => this.compareTmdbToPlex(tmdbResult, plexResult));
|
.then(plexResult => this.compareTmdbToPlex(tmdbResult, plexResult))
|
||||||
|
.catch((error) => {
|
||||||
|
console.log(error)
|
||||||
|
tmdbResult.matchedInPlex = false;
|
||||||
|
return tmdbResult;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
search(query) {
|
search(query) {
|
||||||
@@ -19,6 +24,9 @@ class PlexRepository {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return rp(options)
|
return rp(options)
|
||||||
|
.catch((error) => {
|
||||||
|
throw new Error('Unable to search plex.')
|
||||||
|
})
|
||||||
.then(result => this.mapResults(result))
|
.then(result => this.mapResults(result))
|
||||||
.then(([mappedResults, resultCount]) => ({ results: mappedResults, total_results: resultCount }));
|
.then(([mappedResults, resultCount]) => ({ results: mappedResults, total_results: resultCount }));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user