handle error with try catch
This commit is contained in:
parent
59c7a65d69
commit
c2053608cf
|
|
@ -10,10 +10,16 @@ module.exports = (options) => {
|
|||
options.res.send(reply);
|
||||
}
|
||||
else {
|
||||
options.getHTML((html) => {
|
||||
redis.set(options.req.url, html);
|
||||
options.res.send(html);
|
||||
});
|
||||
try {
|
||||
options.getHTML((html) => {
|
||||
redis.set(options.req.url, html);
|
||||
options.res.send(html);
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
redis.set(options.req.url, '');
|
||||
options.res.send('');
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
Loading…
Reference in New Issue