More accurate checks for what response contains and throws error if it does not exist.
This commit is contained in:
		@@ -30,6 +30,16 @@ const matchingTitleAndYear = (plex, tmdb) => {
 | 
				
			|||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const successfullResponse = response => {
 | 
					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;
 | 
					  const { status, statusText } = response;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (status === 200) {
 | 
					  if (status === 200) {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user