Skip to content

Commit

Permalink
fix(services): improve logging for when Radarr movie already exists (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
azoitos committed Dec 15, 2020
1 parent 33b54c0 commit f998873
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions server/api/radarr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,9 @@ class RadarrAPI {
}
};

public addMovie = async (
options: RadarrMovieOptions
): Promise<RadarrMovie> => {
public addMovie = async (options: RadarrMovieOptions): Promise<void> => {
try {
const response = await this.axios.post<RadarrMovie>(`/movie`, {
await this.axios.post<RadarrMovie>(`/movie`, {
title: options.title,
qualityProfileId: options.qualityProfileId,
profileId: options.profileId,
Expand All @@ -94,15 +92,15 @@ class RadarrAPI {
searchForMovie: options.searchNow,
},
});

return response.data;
} catch (e) {
logger.error('Something went wrong adding a movie to Radarr', {
label: 'Radarr',
message: e.message,
options,
});
throw new Error(`[Radarr] Failed to add movie: ${e.message}`);
logger.error(
'Failed to add movie to Radarr. This might happen if the movie already exists, in which case you can safely ignore this error.',
{
label: 'Radarr',
errorMessage: e.message,
options,
}
);
}
};

Expand Down

0 comments on commit f998873

Please sign in to comment.