chore: handle not found TMDB IDs better

This commit is contained in:
WebStreamr 2025-06-14 18:00:55 +00:00
parent 81d788ef84
commit 5f34be12a9
No known key found for this signature in database

View file

@ -2,6 +2,7 @@ import { ImdbId, TmdbId } from './id';
import { Context } from '../types';
import { Fetcher } from './Fetcher';
import { envGet } from './env';
import { NotFoundError } from '../error';
interface FindResponsePartial {
movie_results: {
@ -51,7 +52,7 @@ export const getTmdbIdFromImdbId = async (ctx: Context, fetcher: Fetcher, imdbId
const id = (imdbId.season ? response.tv_results[0] : response.movie_results[0])?.id;
if (!id) {
throw new Error(`Could not get TMDB ID of IMDb ID "${imdbId.id}"`);
throw new NotFoundError(`Could not get TMDB ID of IMDb ID "${imdbId.id}"`);
}
imdbTmdbMap.set(imdbId.id, id);