Propagate error messages from YouTube API
This commit is contained in:
		
							parent
							
								
									835d16cbb1
								
							
						
					
					
						commit
						e158eeee4b
					
				@ -47,6 +47,9 @@ def response(resp):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    search_results = loads(resp.text)
 | 
					    search_results = loads(resp.text)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    if 'error' in search_results and 'message' in search_results['error']:
 | 
				
			||||||
 | 
					        raise Exception(search_results['error']['message'])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # return empty array if there are no results
 | 
					    # return empty array if there are no results
 | 
				
			||||||
    if 'items' not in search_results:
 | 
					    if 'items' not in search_results:
 | 
				
			||||||
        return []
 | 
					        return []
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user