mirror of
https://github.com/sct/overseerr.git
synced 2025-12-27 00:34:56 +01:00
fix(blacklist): handle invalid keywords gracefully (#1815)
* fix(blacklist): handle invalid keywords gracefully * fix(blacklist): only remove keywords on 404 errors * fix(blacklist): remove non-null assertion and add proper type annotation * refactor(blacklist): return null instead of 404 for missing keywords * fix(blacklist): add type annotation for validKeywords * fix(selector): update type annotation for validKeywords
This commit is contained in:
@@ -1054,7 +1054,7 @@ class TheMovieDb extends ExternalAPI {
|
||||
keywordId,
|
||||
}: {
|
||||
keywordId: number;
|
||||
}): Promise<TmdbKeyword> {
|
||||
}): Promise<TmdbKeyword | null> {
|
||||
try {
|
||||
const data = await this.get<TmdbKeyword>(
|
||||
`/keyword/${keywordId}`,
|
||||
@@ -1064,6 +1064,9 @@ class TheMovieDb extends ExternalAPI {
|
||||
|
||||
return data;
|
||||
} catch (e) {
|
||||
if (e.response?.status === 404) {
|
||||
return null;
|
||||
}
|
||||
throw new Error(`[TMDB] Failed to fetch keyword: ${e.message}`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user