handle error with try catch

This commit is contained in:
DIYgod
2018-04-12 11:49:55 +08:00
parent 59c7a65d69
commit c2053608cf

View File

@@ -10,10 +10,16 @@ module.exports = (options) => {
options.res.send(reply); options.res.send(reply);
} }
else { else {
options.getHTML((html) => { try {
redis.set(options.req.url, html); options.getHTML((html) => {
options.res.send(html); redis.set(options.req.url, html);
}); options.res.send(html);
});
}
catch (e) {
redis.set(options.req.url, '');
options.res.send('');
}
} }
}); });
}; };