mirror of
				https://github.com/mfulz/qmk_firmware.git
				synced 2025-11-04 07:12:33 +01:00 
			
		
		
		
	make json imports more robust (#13928)
This commit is contained in:
		
							parent
							
								
									79d5b27993
								
							
						
					
					
						commit
						5eb0e406fd
					
				@ -17,9 +17,12 @@ def json_load(json_file):
 | 
				
			|||||||
    try:
 | 
					    try:
 | 
				
			||||||
        return hjson.load(json_file.open(encoding='utf-8'))
 | 
					        return hjson.load(json_file.open(encoding='utf-8'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    except json.decoder.JSONDecodeError as e:
 | 
					    except (json.decoder.JSONDecodeError, hjson.HjsonDecodeError) as e:
 | 
				
			||||||
        cli.log.error('Invalid JSON encountered attempting to load {fg_cyan}%s{fg_reset}:\n\t{fg_red}%s', json_file, e)
 | 
					        cli.log.error('Invalid JSON encountered attempting to load {fg_cyan}%s{fg_reset}:\n\t{fg_red}%s', json_file, e)
 | 
				
			||||||
        exit(1)
 | 
					        exit(1)
 | 
				
			||||||
 | 
					    except Exception as e:
 | 
				
			||||||
 | 
					        cli.log.error('Unknown error attempting to load {fg_cyan}%s{fg_reset}:\n\t{fg_red}%s', json_file, e)
 | 
				
			||||||
 | 
					        exit(1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def load_jsonschema(schema_name):
 | 
					def load_jsonschema(schema_name):
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user