[Server] Improve: Better error handling
This commit is contained in:
		
							parent
							
								
									4e9bb87d94
								
							
						
					
					
						commit
						b988445f7b
					
				
					 1 changed files with 3 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -7,10 +7,9 @@ module.exports = (req: express.Request, res: express.Response) => {
 | 
			
		|||
 | 
			
		||||
	request(url, (err, response, xml) => {
 | 
			
		||||
		if (err) {
 | 
			
		||||
			console.error(err);
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
			res.sendStatus(500);
 | 
			
		||||
		} else {
 | 
			
		||||
			res.send(xml2json.toJson(xml));
 | 
			
		||||
		}
 | 
			
		||||
	});
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue