catch errors
							parent
							
								
									7c392e0dea
								
							
						
					
					
						commit
						ca3a006a4a
					
				
							
								
								
									
										8
									
								
								index.js
								
								
								
								
							
							
						
						
									
										8
									
								
								index.js
								
								
								
								
							| 
						 | 
					@ -71,14 +71,14 @@ app.post('/', function(req, res) {
 | 
				
			||||||
	if (!html) {
 | 
						if (!html) {
 | 
				
			||||||
		res.status(400).send("Please provide a POST parameter called html");
 | 
							res.status(400).send("Please provide a POST parameter called html");
 | 
				
			||||||
	} else {	  	
 | 
						} else {	  	
 | 
				
			||||||
		//try {
 | 
							try {
 | 
				
			||||||
			let document = new JSDOM(html);
 | 
								let document = new JSDOM(html);
 | 
				
			||||||
			let markdown = processor.process_dom(url, document, res, inline_title, ignore_links);
 | 
								let markdown = processor.process_dom(url, document, res, inline_title, ignore_links);
 | 
				
			||||||
			send_headers(res);
 | 
								send_headers(res);
 | 
				
			||||||
			res.send(markdown);
 | 
								res.send(markdown);
 | 
				
			||||||
		 //} catch (error) {
 | 
							 } catch (error) {
 | 
				
			||||||
		 //res.status(400).send("Could not parse that document");
 | 
							 res.status(400).send("Could not parse that document");
 | 
				
			||||||
		//}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,8 +13,8 @@ class html_reader {
 | 
				
			||||||
		JSDOM.fromURL(url).then((document)=>{
 | 
							JSDOM.fromURL(url).then((document)=>{
 | 
				
			||||||
			let markdown = processor.process_dom(url, document, res, inline_title, ignore_links);
 | 
								let markdown = processor.process_dom(url, document, res, inline_title, ignore_links);
 | 
				
			||||||
			res.send(markdown);
 | 
								res.send(markdown);
 | 
				
			||||||
		//}).catch((error)=> {
 | 
							}).catch((error)=> {
 | 
				
			||||||
		//	res.status(400).send(failure_message);
 | 
								res.status(400).send(failure_message);
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -47,8 +47,8 @@ class stack_reader {
 | 
				
			||||||
			else {
 | 
								else {
 | 
				
			||||||
				res.send(markdown_q + "\n\n## Answer\n"+ markdown_a);
 | 
									res.send(markdown_q + "\n\n## Answer\n"+ markdown_a);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		//}).catch((error)=> {
 | 
							}).catch((error)=> {
 | 
				
			||||||
		//	res.status(400).send(failure_message);
 | 
								res.status(400).send(failure_message);
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue