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