More accurate checks for what response contains and throws error if it does not exist.

This commit is contained in:
2022-01-03 18:38:32 +01:00
parent 4501bc5302
commit b5bd672f44

View File

@@ -30,6 +30,16 @@ const matchingTitleAndYear = (plex, tmdb) => {
};
const successfullResponse = response => {
if (response && response["MediaContainer"]) return response;
if (
response == null ||
response["status"] == null ||
response["statusText"] == null
) {
throw Error("Unable to decode response");
}
const { status, statusText } = response;
if (status === 200) {