mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	python: Catch JSONDecodeError instead of ValueError when decoding JSON.
These weren’t wrong since orjson.JSONDecodeError subclasses json.JSONDecodeError which subclasses ValueError, but the more specific ones express the intention more clearly. (ujson raised ValueError directly, as did json in Python 2.) Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							2e97d2b9f7
						
					
				
				
					commit
					d0f4af5f8c
				
			@@ -272,7 +272,7 @@ def process_success_response(event: Dict[str, Any],
 | 
			
		||||
                             response: Response) -> None:
 | 
			
		||||
    try:
 | 
			
		||||
        response_json = json.loads(response.text)
 | 
			
		||||
    except ValueError:
 | 
			
		||||
    except json.JSONDecodeError:
 | 
			
		||||
        fail_with_message(event, "Invalid JSON in response")
 | 
			
		||||
        return
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user